[ 
https://issues.apache.org/jira/browse/CAMEL-23343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bjorn Beskow updated CAMEL-23343:
---------------------------------
    Description: 
Using OpenTelemetry instrumentation via the OTEL spring boot starter together 
with {{camel-opentelemetry2}} is not well document, and does not work out of 
the box. The auto-configuration provided by 
{{io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter}} doesn't 
configure all beans required by camel-opentelemetry2 to be fully functional:
 
1. A bean for {{io.opentelemetry.api.trace.Tracer}} is missing, which cause 
{{trace_id}} and {{span_id}} to not be visible in the MDC context used by 
{{io.opentelemetry.instrumentation:opentelemetry-logback-mdc-1.0}}

2. A bean for {{io.opentelemetry.context.propagation.ContextPropagators}} is 
missing, which cause a NOOP propagator being used and hence no propagation 
happens for the camel routes
 
Configuring the beans explicitly solves these problems:
 
{{{{@Configuration}}}}
{{{{public class OpenTelemetryConfiguration {}}}}

{{{{  @Bean}}}}
{{  public Tracer tracer(@Value("${spring.application.name}") String 
serviceName, OpenTelemetry openTelemetry) {}}
{{{{    return openTelemetry.getTracer(serviceName);}}}}
{{  }}}

{{{{  @Bean}}}}
{{  public ContextPropagators contextPropagators(OpenTelemetry openTelemetry) 
{}}
{{{{    return openTelemetry.getPropagators();}}}}
{{  }}}
{{{{}}}}}
 
Attached is a sample project with a single JMS route and integration tests 
which highlight the problem (comment out the {{@Configuration}} annotation in 
\{{OpenTelemetryConfiguration }}to make the tests fail).
 

  was:
Using OpenTelemetry instrumentation via the OTEL spring boot starter together 
with {{camel-opentelemetry2}} is not well document, and does not work out of 
the box. The auto-configuration provided by 
{{io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter}} doesn't 
configure all beans required by camel-opentelemetry2 to be fully functional:
 
1. A bean for {{io.opentelemetry.api.trace.Tracer}} is missing, which cause 
{{trace_id}} and {{span_id}} to not be visible in the MDC context used by 
{{io.opentelemetry.instrumentation:opentelemetry-logback-mdc-1.0}}

2. A bean for {{io.opentelemetry.context.propagation.ContextPropagators}} is 
missing, which cause a NOOP propagator being used and hence no propagation 
happens for the camel routes
 
Configuring the beans explicitly solves these problems:
 
{{@Configuration}}
{{public class OpenTelemetryConfiguration {}}

{{  @Bean}}
{{  public Tracer tracer(
    @Value("${spring.application.name}") String serviceName,
    OpenTelemetry openTelemetry) {}}
{{    return openTelemetry.getTracer(serviceName);}}
{{  }}}

{{  @Bean}}
{{  public ContextPropagators contextPropagators(
    OpenTelemetry openTelemetry) {}}
{{    return openTelemetry.getPropagators();}}
{{  }}}

{{}}}
 
Attached is a sample project with a single JMS route and integration tests 
which highlight the problem (comment out the {{@Configuration}} annotation in 
{{OpenTelemetryConfiguration }}to make the tests fail).
 


> Using OpenTelemetry instrumentation via Spring Boot starter and OpenTelemetry2
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-23343
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23343
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-opentelemetry
>    Affects Versions: 4.18.1
>            Reporter: Bjorn Beskow
>            Priority: Minor
>         Attachments: camel-opentelemetry-starter.zip
>
>
> Using OpenTelemetry instrumentation via the OTEL spring boot starter together 
> with {{camel-opentelemetry2}} is not well document, and does not work out of 
> the box. The auto-configuration provided by 
> {{io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter}} 
> doesn't configure all beans required by camel-opentelemetry2 to be fully 
> functional:
>  
> 1. A bean for {{io.opentelemetry.api.trace.Tracer}} is missing, which cause 
> {{trace_id}} and {{span_id}} to not be visible in the MDC context used by 
> {{io.opentelemetry.instrumentation:opentelemetry-logback-mdc-1.0}}
> 2. A bean for {{io.opentelemetry.context.propagation.ContextPropagators}} is 
> missing, which cause a NOOP propagator being used and hence no propagation 
> happens for the camel routes
>  
> Configuring the beans explicitly solves these problems:
>  
> {{{{@Configuration}}}}
> {{{{public class OpenTelemetryConfiguration {}}}}
> {{{{  @Bean}}}}
> {{  public Tracer tracer(@Value("${spring.application.name}") String 
> serviceName, OpenTelemetry openTelemetry) {}}
> {{{{    return openTelemetry.getTracer(serviceName);}}}}
> {{  }}}
> {{{{  @Bean}}}}
> {{  public ContextPropagators contextPropagators(OpenTelemetry openTelemetry) 
> {}}
> {{{{    return openTelemetry.getPropagators();}}}}
> {{  }}}
> {{{{}}}}}
>  
> Attached is a sample project with a single JMS route and integration tests 
> which highlight the problem (comment out the {{@Configuration}} annotation in 
> \{{OpenTelemetryConfiguration }}to make the tests fail).
>  



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

Reply via email to