Skip to content

Clean up header when tracing is disabled #7367

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

williamscs
Copy link

Summary of changes

When tracing is disabled, also remove the "tracing enabled" header.

Reason for change

We have a use-case where a partner doesn't allow unknown headers. This header allows the tracing headers to not be added, but it still remains when the request is sent, which breaks their system.

Implementation details

Test coverage

None that I found. This is more of a proof of concept to get the maintainers feedback. Happy to dig in more, if this is a good idea.

Other details

@williamscs williamscs requested review from a team as code owners August 8, 2025 02:49
@@ -46,6 +46,10 @@ public static CallTargetState OnMethodBegin<TTarget, TRequest>(TTarget instance,
return new CallTargetState(scope);
}
}
else
{
headers.Remove(HttpHeaderNames.TracingEnabled);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice in theory, but it could run into potential issues 🤔 e.g. there are often nested handlers, and if we remove this header from the first one, the innermost handler may create a span 🤔 I think instead we may need to implement the "black hole" span approach which has been discussed a few times, but which is non-trivial to implement at the moment 🤔

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.

2 participants