Conversation
Introduce the TraceCorrelation enum (None, Link, Parent) to control how the process activity is correlated with the message's send activity when tracing is enabled: - None (default): no correlation, same as before - Link: the process activity links to the send activity, matching the OpenTelemetry messaging semantic conventions - Parent: the process activity becomes a child of the send activity, so both end up in the same trace, and additionally links to the send activity and to the ambient activity (if any) LinkTraces is kept for backward compatibility and is now a shorthand for TraceCorrelation: true maps to Link and false to None. DotPulsarActivitySource.StartConsumerActivity now takes a TraceCorrelation instead of a bool and passes a parent context to ActivitySource.StartActivity when required. Tests added for both DotPulsarActivitySource and ProcessingOptions, and CHANGELOG updated.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When tracing is enabled and
LinkTraces = true, the process activity onthe consumer side only links to the message's send activity. Producer
and consumer therefore end up in two separate traces, hence making it is hard to follow
a single message end-to-end.
This PR makes it possible to use the message creation context as the parent of the process activity instead so producer and consumer end up in the same trace.
This is opt-in. Default behavior is unchanged.
It introduces the
TraceCorrelationenum (None,Link,Parent) and aProcessingOptions.TraceCorrelationproperty that controls how the process activity is correlated with the message's send activity when tracing is enabled:None(default): no correlation, same as beforeLink: the process activity links to the send activity, matching the OpenTelemetry messaging semantic conventions (same asLinkTraces = truetoday)Parent: the process activity becomes a child of the send activity, so both end up in the same trace. It additionally links to the send activity.LinkTraces is kept for backward compatibility and is now a shorthand for TraceCorrelation: true maps to Link and false to None.
DotPulsarActivitySource.StartConsumerActivity now takes a TraceCorrelation instead of a bool and passes a parent context to ActivitySource.StartActivity when required.
Testing
Tests added for both DotPulsarActivitySource and ProcessingOptions. 14 tests in total.
References
https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/#message-creation-context-as-parent-of-process-span