gnodet opened a new pull request, #22255:
URL: https://github.com/apache/camel/pull/22255

   ## Summary
   
   Per the tracing design doc (`proposals/tracing.adoc`), context propagation 
should be handled exclusively via Exchange headers (W3C `traceparent`), not 
ThreadLocal. This PR removes the ThreadLocal-based context propagation 
mechanisms from `camel-opentelemetry2`:
   
   - **`OpenTelemetryTracer.create()`**: When no Camel parent span exists, 
always use `Context.root()` as the base for `extract()`. Removed the 
`BAGGAGE_CAMEL_FLAG` / "dirty context" detection that fell back to 
`Context.current()` — the `extract()` call on Exchange headers is sufficient to 
pick up upstream traces.
   - **`OpenTelemetrySpanAdapter`**: Removed `BAGGAGE_CAMEL_FLAG` constant, 
baggage flag injection in constructor, and `baggageScope` management. Span 
scope (`makeCurrent()`) is kept as it's needed by `inject()`.
   - **Deleted `OpenTelemetryInstrumentedThreadPoolFactory`** and 
**`OpenTelemetryInstrumentedThreadFactoryListener`**: These wrapped Camel 
thread pools with `Context.taskWrapping()` to propagate ThreadLocal context 
across threads — contradicting the design principle that context flows via 
Exchange headers.
   
   This is an alternative approach to the Spring Boot `TaskDecorator` in 
https://github.com/apache/camel-spring-boot/pull/1730 — rather than adding more 
ThreadLocal propagation infrastructure, this follows the design doc's principle 
of Exchange-header-only propagation. If this approach is accepted, 
apache/camel-spring-boot#1730 should be closed as not needed.
   
   ## Test plan
   
   - [x] All 12 existing tests pass (`mvn test -B -pl 
components/camel-opentelemetry2`) — they use header-based propagation
   - [x] Code formatted (`mvn formatter:format impsort:sort`)
   
   _Claude Code on behalf of Guillaume Nodet_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to