-
Notifications
You must be signed in to change notification settings - Fork 786
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
Add isRemote check for context propagation #3329
Changes from 3 commits
f9d423b
de0573f
ea48192
523decb
95c59d1
196ad18
43f8de6
c7b7161
3194863
594bf0d
3615b7b
c9880cc
fb2d5a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -199,7 +199,7 @@ internal TracerProviderSdk( | |||||||||||||
else if (sampler is AlwaysOffSampler) | ||||||||||||||
{ | ||||||||||||||
listener.Sample = (ref ActivityCreationOptions<ActivityContext> options) => | ||||||||||||||
!Sdk.SuppressInstrumentation ? PropagateOrIgnoreData(options.Parent.TraceId) : ActivitySamplingResult.None; | ||||||||||||||
!Sdk.SuppressInstrumentation ? PropagateOrIgnoreData(options.Parent.TraceId, options.Parent.IsRemote) : ActivitySamplingResult.None; | ||||||||||||||
this.getRequestedDataAction = this.RunGetRequestedDataAlwaysOffSampler; | ||||||||||||||
} | ||||||||||||||
else | ||||||||||||||
|
@@ -393,13 +393,13 @@ private static ActivitySamplingResult ComputeActivitySamplingResult( | |||||||||||||
return activitySamplingResult; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
return PropagateOrIgnoreData(options.Parent.TraceId); | ||||||||||||||
return PropagateOrIgnoreData(options.Parent.TraceId, options.Parent.IsRemote); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||||||||||||||
private static ActivitySamplingResult PropagateOrIgnoreData(ActivityTraceId traceId) | ||||||||||||||
private static ActivitySamplingResult PropagateOrIgnoreData(ActivityTraceId traceId, bool isParentRemote) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could probably explore updating the method signature here to something like this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor:
I have updated the method signature |
||||||||||||||
{ | ||||||||||||||
var isRootSpan = traceId == default; | ||||||||||||||
var isRootSpan = traceId == default || isParentRemote; | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is semantically buggy, I guess? Maybe: var isRootSpan = traceId == default;
return isRootSpan || isParentRemote
? ... |
||||||||||||||
|
||||||||||||||
// If it is the root span select PropagationData so the trace ID is preserved | ||||||||||||||
// even if no activity of the trace is recorded (sampled per OpenTelemetry parlance). | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TracerProvider modified to create activity irrespective of SamplingResult, for spans with Remote Parent, to maintain context propagation.
^ or similar wording.