[ 
https://issues.apache.org/jira/browse/CAMEL-21472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17902775#comment-17902775
 ] 

Thomas Gantenbein commented on CAMEL-21472:
-------------------------------------------

If you remove MDC support, doesn't that defeat one of the main purposes of 
tracing, i.e. the ability to trace a particular request over several services? 
If I don't have the traceId somewhere in the logs, it's hard to find a 
particular trace. Moreover, unless the option `traceProcessors` is true, the 
context is not passed to other threads, so even if logs were sent via a 
[Opentelemetry logs 
bridge|https://opentelemetry.io/docs/specs/otel/logs/#new-first-party-application-logs]
 instead of using MDC, I doubt that this would work, since that bridge would 
have no knowledge about the current context either if a route was using a new 
thread in the middle of its execution (for example after a delay EIP).

Maybe if tracing is enabled, every processor should _always_ be intercepted so 
that context can be passed? 
[https://github.com/apache/camel/blob/main/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryTracingStrategy.java#L45]
 almost has what may be needed, but maybe this should be invoked per default so 
that every processor would be wrapped at least in a 
[PropagateContext|https://github.com/apache/camel/blob/main/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryTracingStrategy.java#L52]?

> Opentelemetry is using the same traceId when exchange is fired from file or 
> timer component
> -------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-21472
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21472
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-opentelemetry
>    Affects Versions: 4.8.1
>            Reporter: Thomas Gantenbein
>            Assignee: Pasquale Congiusti
>            Priority: Major
>             Fix For: 4.8.3, 4.10.0
>
>         Attachments: image-2024-11-26-09-59-35-555.png, 
> image-2024-11-29-17-04-16-581.png, image-2024-11-29-17-06-26-116.png, 
> image-2024-11-29-17-06-42-860.png, image-2024-11-29-17-12-49-768.png, 
> image-2024-11-29-17-12-58-036.png
>
>
> *Problem*
> When using a consumer like {{timer}} or {{{}file{}}}, the traceId remains the 
> same for all messages. When using a consumer like netty (or, I assume, any 
> other http/tcp-based consumer), every call gets its own traceId as expected.
> See also 
> https://camel.zulipchat.com/#narrow/channel/257298-camel/topic/Same.20OTEL.20trace.20for.20all.20messages.20into.20IBM.20MQ
> *Reproducer*
> [https://github.com/thomas-gantenbein-tga/camel-opentelemetry/tree/main]
> [~pcongiusti], thanks for your answer on Zulip Chat. Let me know if I should 
> further explain or minimize that reproducer.



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

Reply via email to