Andrea Cosentino created CAMEL-19051:
----------------------------------------

             Summary: Camel-opentelemetry: Avoid using the 
GlobalOpenTelemetry.get() and allow for injection of ContextPropagators
                 Key: CAMEL-19051
                 URL: https://issues.apache.org/jira/browse/CAMEL-19051
             Project: Camel
          Issue Type: Bug
            Reporter: Andrea Cosentino
             Fix For: 4.0-M2, 4.0


A problem occures when using opentelemetry 4.0.0-M1 with spring-boot auto 
configuration.

The autoconfiguration works as expected and the resulting openTelemetry bean is 
as expected.
But when the first request comes in, the autoconfigured bean is not used and 
another openTelemetry configured with OpenTelemetry.noop() is used.

org.apache.camel.opentelemetry.OpenTelemetryTracer#startExchangeBeginSpan uses 
GlobalOpenTelemetry.get(), which in turn looks into it's 
io.opentelemetry.api.GlobalOpenTelemetry#globalOpenTelemetry which was not set 
and so it creates the noop implementation.

First step to fix without side effects is to allow the explicit setting of the 
ContextPropagators which then can be used by 
org.apache.camel.opentelemetry.starter.OpenTelemetryAutoConfiguration#openTelemetryEventNotifier
 to use the proper autoconfigured instances.

https://camel.zulipchat.com/#narrow/stream/257301-camel-spring-boot/topic/opentelemetry/near/327478493



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to