Skip to content

Adding support for W3C Baggage header - #45839

Closed
jbogard wants to merge 2 commits into
dotnet:masterfrom
jbogard:baggage-header
Closed

jbogard wants to merge 2 commits into
dotnet:masterfrom
jbogard:baggage-header

Conversation

@jbogard

@jbogard jbogard commented Dec 9, 2020

Copy link
Copy Markdown
Contributor

Preserves backward compatibility for legacy Correlation-Context header name;

Addresses #45496

@ghost

ghost commented Dec 9, 2020

Copy link
Copy Markdown

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti
See info in area-owners.md if you want to be subscribed.

Issue Details

Preserves backward compatibility for legacy Correlation-Context header name;

Addresses #45496

Author: jbogard
Assignees: -
Labels:

area-System.Diagnostics.Tracing

Milestone: -

@ericstj

ericstj commented Jan 4, 2021

Copy link
Copy Markdown
Member

@tommcdon @karelz it looks like this is touching HttpHandlerDiagnosticListener which was added in dotnet/corefx#18101. According to comments

/// A HttpHandlerDiagnosticListener is a DiagnosticListener for .NET 4.6 and above where
/// HttpClient doesn't have a DiagnosticListener built in. This class is not used for .NET Core
/// because HttpClient in .NET Core already emits DiagnosticSource events. This class compensates for
/// that in .NET 4.6 and above. HttpHandlerDiagnosticListener has no public constructor. To use this,
/// the application just needs to call <see cref="DiagnosticListener.AllListeners" /> and
/// <see cref="DiagnosticListener.AllListenerObservable.Subscribe(IObserver{DiagnosticListener})"/>,
/// then in the <see cref="IObserver{DiagnosticListener}.OnNext(DiagnosticListener)"/> method,
/// when it sees the System.Net.Http.Desktop source, subscribe to it. This will trigger the
/// initialization of this DiagnosticListener.

I think we need someone from both @dotnet/ncl and @dotnet/dotnet-diag to review this.

@tarekgh

tarekgh commented Jan 4, 2021

Copy link
Copy Markdown
Member

CC @noahfalk

sdmaclea
sdmaclea previously approved these changes Jan 5, 2021

@sdmaclea sdmaclea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@josalem josalem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The diagnostics changes look okay to me (maintains the old header name for back-compat and adds a test covering both header names). I can't comment on the correctness of the header names, etc.

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I want to pump the brakes on this a bit but I do appreciate the PR! A couple thoughts:

  1. The .NET team has been burned a bit in the past implementing W3C distributed tracing specs that weren't finalized. We were assured the specs were stable so we took a dependency on the prescribed names and then after our APIs were already released one of the names was changed. Although its water under the bridge, it was also lesson learned... we have to be wary implementing draft specs. I'm fine doing something in an experimental capacity such as a fork, an ifdef, a runtime check, etc, but I am not comfortable emitting the baggage header by default at this time.

  2. Preferably I'd like us to decide on a plan that accounts for all versions of .NET where DiagnosticSource.dll runs before we start committing to specific implementations. I expect some differences in design or implementation will be necessary, but I want to make sure we minimizing them as much as possible. There is likely high overlap with the custom propagators request that recently showed up: dotnet/aspnetcore#28642

  3. Even if the framework has some default behavior, this seems like a spot where we might want to give the app the final say about which headers, if any, get emitted? Baggage is potentially large and double-encoding it just in case might be problematic for some scenarios. There are also some .NET developers who object to the Http stack adding any header to their request implicitly. If there was an API to opt-in to the new baggage header that also might alleviate the concern in part (1) while allowing early adopters to utilize it.

I think a good next step would be to first make a design proposal in #45496 that covers the suggested behavior/API for all versions of .NET. I don't think baggage should start on by default but you are welcome to propose otherwise if you have reasons to disagree. The proposal could also be converged with the propoagators work or you could say why you think combining it is a bad idea.

@stephentoub stephentoub added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Jan 15, 2021
@sdmaclea
sdmaclea dismissed their stale review February 22, 2021 17:16

@noahfalk's opinion is more important

@noahfalk

Copy link
Copy Markdown
Member

I'm going to go ahead and close this PR for now. I'm not at all opposed to having .NET support this in some capacity but there are some issues above that I think need to be addressed first. Thanks @jbogard!

@noahfalk noahfalk closed this Feb 23, 2021
@jbogard

jbogard commented Feb 24, 2021

Copy link
Copy Markdown
Contributor Author

No worries, thanks for taking a look!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Diagnostics.Tracing NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants