open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.95k stars 854 forks source link

Opentelemetry > Camel > tracing information lost between incoming and outgoing message (opentelemetry-java-instrumentation) #4052

Open ghilainm opened 3 years ago

ghilainm commented 3 years ago

I am using Camel 3.11.0 with Spring boot and opentelemetry-java-instrumentation java agent version 1.3.1 to implement distributed tracing across my microservices.

The trace id is not propagated between the input and output message. A new trace id is created for outgoing messages and therefore correlation is lost.

If you need additional information to investigate don't hesitate to ask.

(see discussion here -> https://camel.zulipchat.com/#narrow/stream/257298-camel/topic/OpenTelemetry.20-.20Trace.20Messages)

Sample project -> https://github.com/ghilainm/camel-spring-boot-showcase

mateuszrzeszutek commented 3 years ago

Camel has its own, official OpenTelemetry integration: https://camel.apache.org/components/latest/others/opentelemetry.html (since 3.5). Have you tried using it?

ghilainm commented 3 years ago

@mateuszrzeszutek No my goal was to have something transparent to the service being instrumented. I don't want to add a dependency to opentelemetry directly :).

mateuszrzeszutek commented 3 years ago

Yeah, that certainly makes sense. I guess we need a javaagent instrumentation for Camel 3+ then (we could just automatically apply the camel one I suppose). I'll change the type of this issue to enhancement, since this is about a new instrumentation.

logamanig commented 2 years ago

Do we have any plan to support camel 3.x in near future? Most of the applications now using camel 3.x rather than 2.x and it would be helpful to have built-in support from java-instrumentation to avoid manual instrumentation from the libraries. We are using java-instrumentation and everything works as expected like http tracing, database etc except camel communication.

Since Enterprise Integration Patterns are used by many teams, is it possible to provide higher priority for Camel 3.x implementation please?

mateuszrzeszutek commented 1 year ago

Related issue: https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7137

Seems like Camel is actually using the GlobalOpenTelemetry to get a tracer:

            tracer = GlobalOpenTelemetry.get().getTracer(instrumentationName);

so it should be fully compatible with the OpenTelemetry javaagent; that is, if you exclude the context propagation bug linked above.