-
Couldn't load subscription status.
- Fork 5.2k
[System.Diagnostics.DiagnosticSource.Activity] Reset recorded flag when creating activity when not requested by sampler(s) #111289
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
Conversation
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs
Show resolved
Hide resolved
|
@CodeBlanch how likely this change can break anyone depending on the current behavior? I am asking to know if we need to file a breaking change for that. |
@tarekgh I thought about just removing that line. That would probably take care of it. The reason I went with the explicit clear is because right now |
Kind of hard to say. Here are some thoughts... The default sampler in OTel is So no one using the defaults will be impacted. To be impacted users would have to switch the sampler or make a custom one which attempts to drop remote things. The bug is such that the drop isn't really respected. Recorded causes the spans to be exported (but they have IsAllDataRequested=false so they won't be populated). Impact is probably higher costs, maybe some screwy spans without data. What may be more interesting is that span, if it is propagated out of proc, will be transmitted as Recorded. So some other system downstream using FWIW if this was being done in OTel SDK we would probably call it a breaking change to align behavior with spec. |
We don't have to remove the line if we are worried about the future adding to the flags. But we can just modify it to the following: activity.ActivityTraceFlags = parentContext.TraceFlags & ~ActivityTraceFlags.Recorded; |
That makes me feel we need to file a breaking change to get this documented. @noahfalk may weigh on that too. Here is where you can file the breaking change https://github.com/dotnet/docs/issues/new?template=02-breaking-change.yml. |
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.
Thanks @CodeBlanch
Yeah, I think a breaking change notice would be warranted here. For downlevel what is the plan? Just warn users that they won't be able to disable the recorded flag? |
|
@CodeBlanch could you please file the breaking change in https://github.com/dotnet/docs/issues/new?template=02-breaking-change.yml? Thanks! |
|
@tarekgh Done, see link above ^ |
|
Added When you commit this breaking change:
Tagging @dotnet/compat for awareness of the breaking change. |
|
/ba-g the failure is known build timeout issue happening in other PRs too. |
| activity.ActivityTraceFlags = parentContext.TraceFlags; | ||
| // Note: Don't inherit Recorded from parent as it is set below | ||
| // based on sampling decision | ||
| activity.ActivityTraceFlags = parentContext.TraceFlags & ~ActivityTraceFlags.Recorded; |
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.
Why does this line exist at all? If W3C trace context introduces new flags, what is to say that inheriting the flags from the parent will be the correct thing to do for those new flags?
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.
Ah, I see this was already discussed... removing the line seems more correct to me...
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.
In looking at the latest editor's draft of the spec, there is a new flag proposed: Random Trace ID Flag. My read of this flag is that it actually should be inherited from the parent, but there's no way to be certain this will be true for all new flags.
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.
Keeping this line is not hurting for now. Any newly introduced flag will need to be decided if it is inheritable from the parent or not anyway.
📋 Breaking Change Documentation RequiredCreate a breaking change issue with AI-generated content Generated by Breaking Change Documentation Tool - 2025-10-03 13:49:29 |
|
@ericstj the breaking change for this is already submitted and finalized dotnet/docs#44282. |
|
Thank you @tarekgh |
Changes
ActivityTraceFlags.Recordedwhen creating activity if not requested by sampler(s) because it may be inherited from a parentDetails
[Ran into this while working on #6058.]
Scenario:
traceparentmarked asRecorded.Recorded=true. A propagation-only span should haveRecorded=false./cc @tarekgh @noahfalk @samsp-msft @cijothomas @alanwest