Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.20.2, 3.x, 4.0.0
-
None
-
Unknown
Description
As discussed in the PR it seems that the `Tracer`component from `camel-tracing` is not continuing spans if a `AbstractInternalSpanDecorator` is being created. So for the following route
from("direct://foo") .log("hello") .to("direct://bar") .to("http://example.org"); from("direct://bar") .log("hello") .to("direct://micrometer") .to("http://example.org"); from("direct://micrometer") .setHeader(MicrometerConstants.HEADER_METRIC_NAME, constant("new.name")) .setHeader(MicrometerConstants.HEADER_METRIC_TAGS, constant(Tags.of("dynamic-key", "dynamic-value"))) .to("micrometer:counter:name.not.used?tags=key=value") .to("direct://baz"); from("direct://baz") .log("hello") .to("bean:com.example.cameldemo.MyBean") .to("exec:wc?args=--words /usr/share/dict/words") .process(exchange -> { // Use the Camel Exec String type converter to convert the ExecResult to String // In this case, the stdout is considered as output String wordCountOutput = exchange.getIn().getBody(String.class); // do something with the word count System.out.println(wordCountOutput); }) .to("file:///tmp/camel-outputdir?flatten=true") .to("http://example.org");
you will get multiple traces since the `direct` components are not linked together (they are treated as a start of a new trace).
I think we agreed that for this route example, multiple routes are linked together but all in all they form a single trace. So if `org.apache.camel.tracing.Tracer.TracingEventNotifier#shouldExclude` would be changed from
private boolean shouldExclude(SpanDecorator sd, Exchange exchange, Endpoint endpoint) { return sd instanceof AbstractInternalSpanDecorator || !sd.newSpan() || isExcluded(exchange, endpoint); }
to
private boolean shouldExclude(SpanDecorator sd, Exchange exchange, Endpoint endpoint) { return !sd.newSpan() || isExcluded(exchange, endpoint); }
then the span parent-child relationship gets maintained the way it should
Attachments
Attachments
Issue Links
- is related to
-
CAMEL-19023 Add support for Micrometer Observation
- Resolved