In an application auto instrumented with the javaagent, it looks possible to add manual instrumentation according to the documentation.
- For auto instrumentation, I know we can use environment variables or system properties. For instance
OTEL_TRACES_EXPORTER=loggingto enable logging exporter for traces. - Now, for manual instrumentation, we should instantiate somehow a
OpenTelemetrySdkand register aSdkTracerProvider(configured either manually or via env variables/system properties as well)
What happens if auto instrumentation configures some exporters (logging for instance) and manual instrumentation define another one (OTLP/HTTP for instance)?
Is there a unique instance of OpenTelemetry in this case or two living each in "different contexts"?
Several questions but related to the same topic: how manual and auto instrumentation live together?
(For additional context, I'm looking to have manual metrics, auto instrumented traces and potentially some manual traces as well)
Even though the question is a bit broad, let me try to give some hints to users that would read it.
OpenTelemetryinstances. The java agent would instantiate and register the global instance (GlobalOpenTelemetry) and your code may instantiate anotherOpenTelemetrybut not register it as the global one.OpenTelemetryinstance or the other and you'd loose "correlation". For instance, with traces, you may get two traces instead of one.OpenTelemetrySdkwith manual configs, or by using environment variables / system properties as the java agent is doing thanks toopentelemetry-sdk-extension-autoconfiguredependency.GlobalOpenTelemetry.get().OpenTelemetryinstance and use your framework to provide it by callingGlobalOpenTelemetry.get()at startup.