taoensso.timbre.appenders.community.otlp

OpenTelemetry Protocol (OTLP) appender.
Requires <https://github.com/steffan-westcott/clj-otel>.

appender

clj

(appender {:keys [logger-provider]})
Returns a `com.github.steffan-westcott/clj-otel-api` appender.

For use WITH OpenTelemetry Java Agent-

  Setup a Java Agent appender, e.g.:
    (otlp/appender {:logger-provider (.getLogsBridge (GlobalOpenTelemetry/get))})

  For agent v1.x: enable the logs exporter with `OTEL_LOGS_EXPORTER=otlp`.
  For agent v2.x: the logs exporter should be enabled by default [1].

For use WITHOUT OpenTelemetry Java Agent-

  Setup an "autoconfiguration" appender, e.g.:
    (otlp/appender
      {:logger-provider
       (.getSdkLoggerProvider
         (.getOpenTelemetrySdk
           (.build (AutoConfiguredOpenTelemetrySdk/builder))))})

  You'll need the following on your classpath:
    `io.opentelemetry/opentelemetry-sdk-extension-autoconfigure`,
    `io.opentelemetry/opentelemetry-exporter-otlp`.

  If you already have an instance of `GlobalOpenTelemetry` (e.g. created
  by agent), you'll need to prevent setting the newly-created SDK as the
  global default:
    (.build
      (doto (AutoConfiguredOpenTelemetrySdk/builder)
        (.setResultAsGlobal false)))

[1] Ref. <https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md#version-200-2024-01-12>