You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "James Netherton (Jira)" <ji...@apache.org> on 2023/06/19 09:01:00 UTC
[jira] [Created] (CAMEL-19469) camel-opentelemetry: Context not propagated correctly when tracing bean or processor invocations with @WithSpan
James Netherton created CAMEL-19469:
---------------------------------------
Summary: 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: Bug
Components: camel-opentelemetry
Affects Versions: 4.0-M3, 3.20.5
Reporter: James Netherton
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)