Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(impl): Support custom span creation in Processor #124

Open
wants to merge 1 commit into
base: quarkus-3.8
Choose a base branch
from

Conversation

edeweerd1A
Copy link
Contributor

@edeweerd1A edeweerd1A commented Oct 11, 2024

Probably a very narrow use case.
But it could happen.
Along the way of a recent PR by @nreant1A trying to make sure:

  1. Baggage is properly propagated
  2. Custom span creationg is supported in process method

First added 1 QuarkusTest in impl.

The implementation was:

  1. extracting the parent context (but not making it current, by which baggage were lost)
  2. creating a "process" span and making that a current span
  3. early on reinjecting the new span context ids in the message before it starts being processed, relying on the fact that output message are created by modification of the incoming one: ping.withValue(...)

The issue we have: baggage cannot be modified in the processor, and any other context modification in the processor is basically ignored (creating a custom span for instance).

Solution: move the injection of the contextual data (traceparent, tracestate, baggage) at message production by implementing a TracingProducerInterceptor.

The OpenTelemetryExtension for JUnit 5 has bean copy pasted so we can inject the W3CBaggagePropagator.
Indeed the original class is final, with private constructor.
A fix upstream will be done shortly.

Also the KStreamTopologyDriverTest started failing in tests related to tracing.
Actually in tests based on TopologyTestDriver, the ProducerOnSendInterceptors are not called.
The solution is to transform those tests methods in ones using the Kafka Devservices.

@edeweerd1A edeweerd1A requested a review from a team as a code owner October 11, 2024 14:50
Probably a very narrow use case.
But it could happen.
Along the way of a [recent PR](quarkiverse#109) by @nreant1A trying to make sure:

1. Baggage is properly propagated
2. Custom span creationg is supported in process method

First added 1 QuarkusTest in impl.

The implementation was:

1. extracting the parent context (but not making it current, by which baggage were lost)
2. creating a "process" span and making that a current span
3. early on reinjecting the new span context ids in the message before it starts being processed, relying on the fact that output message are created by modification of the incoming one: `ping.withValue(...)`

The issue we have: baggage cannot be modified in the processor, and any other context modification in the processor is basically ignored (creating a custom span for instance).

Solution: move the injection of the contextual data (traceparent, tracestate, baggage) at message production by implementing a TracingProducerInterceptor.

The OpenTelemetryExtension for JUnit 5 has bean copy pasted so we can inject the W3CBaggagePropagator.
Indeed the original class is final, with private constructor.
A fix upstream will be done shortly.

Also the KStreamTopologyDriverTest started failing in tests related to tracing.
Actually in tests based on TopologyTestDriver, the ProducerOnSendInterceptors are not called.
The solution is to transform those tests methods in ones using the Kafka Devservices.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant