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

   # Description
   
   [CAMEL-26683](https://issues.apache.org/jira/browse/CAMEL-26683)
   
   `OpenTelemetryTracingStrategy` decides whether to activate a context of its 
own for a processor with `target instanceof GetCorrelationContextProcessor || 
target instanceof SetCorrelationContextProcessor` (in 
`PropagateContextAndCreateSpan` and in `PropagateContext`). It only looks at 
the outermost `target`. When another `InterceptStrategy` is applied before it, 
`target` is that strategy's wrapper and the check does not match. The 
correlation context processors then run with a context of their own: the 
baggage that `SetCorrelationContextProcessor` sets is lost when that context is 
deactivated, and `GetCorrelationContextProcessor` does not find it.
   
   Change: both checks look through `DelegateProcessor` wrappers, with the same 
loop as `TraceProcessorsInterceptStrategy.isEndpointSending` in 
camel-telemetry. camel-opentelemetry is deprecated in favour of 
camel-opentelemetry2, which has no such type check, so the change is kept small.
   
   Note on the order: `DefaultChannel` reverses the list of strategies, so the 
strategy that wraps the processor first is the one added to the CamelContext 
*after* the tracer (the JIRA says "registered before", meaning applied before). 
Test `OpenTelemetryTracingStrategyWrappedProcessorTest` adds a strategy that 
wraps every processor in a `DelegateAsyncProcessor`, after the OpenTelemetry 
one, and checks that the baggage set by `SetCorrelationContextProcessor` is 
read by `GetCorrelationContextProcessor`: once with processor spans, and once 
with `propagateContext` for processors excluded from tracing.
   
   On main both tests fail (`expected: <baggage-value> but was: <null>`); with 
only one of the two checks changed, the test of the other path fails. With the 
fix 2/2, and 100/100 over 20 runs together with `SpanProcessorsTest`, 
`OpenTelemetryTracingStrategyTest` and 
`OpenTelemetryTracingStrategyPropagateContextTest`. camel-opentelemetry module 
tests: 25 run, 0 failures (offline, against OpenTelemetry 1.66.0, the newest 
version I had offline; main uses 1.67.0).
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-26683](https://issues.apache.org/jira/browse/CAMEL-26683).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built the core modules and camel-opentelemetry with the formatter and 
import-sort plugins and ran the module tests; no generated file changes. I did 
not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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