-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Support W3C Baggage proposed standard in HttpHandlerDiagnosticListener #45496
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
@tommcdon I think this is probably yours, I didn't get the label magic to work. It's |
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti Issue DetailsThe W3C Correlation-Context proposed standard was renamed to "baggage". As part of that rename, the header was renamed from The details of the spec are in public working draft, which remain the same as Since this is a potentially breaking change (server may be expecting the legacy name
Related: dotnet/aspnetcore#28319
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsThe W3C Correlation-Context proposed standard was renamed to "baggage". As part of that rename, the header was renamed from The details of the spec are in public working draft, which remain the same as Since this is a potentially breaking change (server may be expecting the legacy name
Related: dotnet/aspnetcore#28319
|
Triage: We should do it once the spec is final. Is that the case already @jbogard? |
No, it is not. It moved into the first public working draft status back on October 20th, 2020. However, the It's in an odd place - the name of the standard/header was renamed, and now in public working draft, but it was the "old" name, never standardized, that was implemented for .NET Core 3.0. |
Oh, does it mean that we implemented a draft, that won't be part of the final spec? |
Yes - it was a draft implemented. The simplest way would be to generate both headers. It's different than the transition from |
I've reached this page after finding that While I can see the advantage of this for systems where services are closely-coupled/in-house/public-domain I'm not so sure about defaulting it on for every HTTP request. Some requests will be going to 3rd parties where we definitely DON'T want details stored in Maybe I'm just missing the configuration setting which allows me to enabled/disable this feature on a request-by-request or HttpClient basis. |
Lack of this functionality makes inconsistent behavior because Activity.Baggage is send via 'Correlation-Context' header and in ASP.NET Core this header is ignored (because change in this PR dotnet/aspnetcore@281679e#diff-f4b6e9bc19da99141d4427d88673ed12fdf3474082f571b027a583cb6959ca99 by @jbogard ) so baggage is lost. |
@dominikjeske can't you use DistributedContextPropagator.Inject to inject the baggage with the desired header name? |
@tarekgh It is not a problem for me to send something with correct header - I can use OpenTelemetry to include Baggage and read it or I can do it manually with delegating handlers and custom middleware but this is not a point. I described two problems with default behavior which I find confusing:
ps. Is there a way do disable propagation of Activity.Baggage? |
As of .NET 8, it is still the behavior to send the |
Unfortunately my tests on .NET 8 confirms that situation is still broken. Maybe I will put my results here to show how much broken it is especially when using with Open Telemetry and I think many people are using OTel now. My test environment PowerShell A -> WebApi B -> WebApi C.
Problem is that ASP.NET Core supports both headers and http client support one and none of this is configurable. Additionally we have two Baggages and logic from OTel. Maybe it is time to clean this? |
For those who want to change this behavior - you should override DistributedContextPropagator.Current with own implementation instead LegacyPropagator. It is weird that default propagator is named LegacyPropagator :) |
The baggage has reached "W3C Candidate Recommendation" state! But I don't think it can be implemented without some API changes. I.e. I should be able to use baggage with disabled/dropped activities. Leaving aside the baggage API, the propagator needs to be able to inject baggage. It currently has the following methods:
and should get a new method like
Slightly off-topic - the propagator API is quite hard to use:
So along with W3C |
Ah great news! |
I think, we can probably workaround as shown below with the existing APIs itself:
(Assuming its too late for .NET 9 changes! The proposed additional method is already there, just marked internal.. not sure if that was intentional....) |
We can definitely workaround in OTel, but not in the .NET implementation of the
is probably non-controversial API addition which would still be enough to implement basic |
I think the comment is mostly regarding W3C and ignoring the legacy cases.
The Activity was needed in the injection to inject the
This is true only for W3C. for legacy activities will be RequestId. I think this is why named traceId covers both cases.
This makes sense. |
Hi, I have slightly different scenario. Hope there is somebody able to explain, what is happening in this case:
Note: There is no custom logic in Service 2 handling anything around Baggage or Activities - purely auto-instrumented. My expectation is that "baggage" header is simply propagated further as it is. Anyone able to explain this behaviour? |
@fiha8 See my analyse above from 28 March. .NET reads baggage and Correlation-Context but http client LegacyPropagator only understands Correlation-Context so Service2 is sending only this. To fix this you should use your own propagator or use OTel. |
The W3C Correlation-Context proposed standard was renamed to "baggage". As part of that rename, the header was renamed from
Correlation-Context
tobaggage
.The details of the spec are in public working draft, which remain the same as
Correlation-Context
except with the header name change.Since this is a potentially breaking change (server may be expecting the legacy name
Correlation-Context
, either this can be a clean break (remove/renameCorrelation-Context
tobaggage
), or it can be done in phases:Related: dotnet/aspnetcore#28319
The text was updated successfully, but these errors were encountered: