[
https://issues.apache.org/jira/browse/CAMEL-19469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17829804#comment-17829804
]
James Netherton commented on CAMEL-19469:
-----------------------------------------
{quote}The OpenTelemetryTracingStrategy already creates a Span for
Processors{quote}
True, but that wasn't the case when this issue was created. So this issue
probably needs a retest / reassessment.
> camel-opentelemetry: Context not propagated correctly when tracing bean or
> processor invocations with @WithSpan
> ---------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-19469
> URL: https://issues.apache.org/jira/browse/CAMEL-19469
> Project: Camel
> Issue Type: Improvement
> Components: camel-opentelemetry
> Affects Versions: 3.20.5, 4.0-M3
> Reporter: James Netherton
> Priority: Minor
>
> OpenTelemetry enables you to trace arbitrary method invocations by tagging
> them with the @WithSpan annotation:
> https://opentelemetry.io/docs/instrumentation/java/automatic/annotations/#creating-spans-around-methods-with-withspan
> For some scenarios, the tracing context does not seem to get propagated and
> the resulting spans end up being disassociated. For example:
> {code}
> from("timer:tick?period=5s)
> .process("myProcessor");
> {code}
> {code}
> public class MyProcessor implements Processor {
> @WithSpan
> @Override
> public void process(Exchange exchange) {
> // Useful work here...
> }
> }
> {code}
> This results in 2 spans. One for timer:tick & another for MyProcessor. The
> problem is that the parent span for MyProcessor is not set, so they appear as
> 2 distinct traces.
> There is a workaround where you can configure the route like this and the
> span hierarchy ends up being correct:
> {code}
> from("timer:tick?period=5s")
> .to("direct:start");
> from("direct:start")
> .process("myProcessor");
> {code}
> There's some more background in the original issue reported on Camel Quarkus:
> https://github.com/apache/camel-quarkus/issues/4981
> There's also a reproducer project here:
> https://github.com/jamesnetherton/camel-opentelemetry-demo
--
This message was sent by Atlassian Jira
(v8.20.10#820010)