Additional instrumentation

Ви переглядаєте англійську версію сторінки, тому що її ще не було повністю перекладеною українською. Бажаєте допомогти? Дивіться як взяти Участь.

PS. Неофіційний український переклад (не перевірений і не ухвалений OpenTelemetry) доступний на сайті члена спільноти, створеному на основі PR #5891. Ми надаємо це посилання як тимчасовий захід підтримки українських читачів та потенційних учасників, доки не буде готовий офіційний переклад.

The OpenTelemetry Spring Boot starter provides out of the box instrumentation that you can augment with additional instrumentations.

Log4j2 Instrumentation

You have to add the OpenTelemetry appender to your log4j2.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="io.opentelemetry.instrumentation.log4j.appender.v2_17">
    <Appenders>
        <OpenTelemetry name="OpenTelemetryAppender"/>
    </Appenders>
    <Loggers>
        <Root>
            <AppenderRef ref="OpenTelemetryAppender" level="All"/>
        </Root>
    </Loggers>
</Configuration>

You can find more configuration options for the OpenTelemetry appender in the Log4j instrumentation library.

Enables the configuration of the Log4j OpenTelemetry appender with an OpenTelemetry instance:

otel:
  instrumentation:
    log4j-appender:
      enabled: true # default: true

In declarative configuration, use the centralized instrumentation lists to enable or disable Log4j:

otel:
  distribution:
    spring_starter:
      instrumentation:
        disabled:
          - log4j_appender

Instrumentation libraries

You can configure other instrumentations using OpenTelemetry instrumentation libraries.