Skip to content
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

What should the default DistributedContextPropagator be #56794

Closed
MihaZupan opened this issue Aug 3, 2021 · 3 comments
Closed

What should the default DistributedContextPropagator be #56794

MihaZupan opened this issue Aug 3, 2021 · 3 comments

Comments

@MihaZupan
Copy link
Member

#50658 and #55556 added APIs for controlling distributed context propagation.
Part of those APIs is a CreateDefaultPropagator method that is used to seed the global static Current property.

HttpClient and ASP.NET Core both consume these APIs and as such inherit the default behavior.

CreateDefaultPropagator currently returns a LegacyPropagator, which is preserving pre-.NET 6 behavior of injecting context by default.

Having injection ON by default means some user scenarios work out of the box:

  • ASP.NET Core services will preserve the trace across process boundaries even if they haven't been explicitly instrumented for distributed tracing
  • For services that collect logs, actions performed across different services can still be attributed to a shared incoming request
  • Even when some of the services are not instrumented, others still benefit from the trace as it continues to flow

On the other hand it brings some downsides:

  • Some services are very strict about the headers they are expecting and may refuse requests that contain trace-related headers. This may be relatively difficult for users to diagnose as the behavior of HttpClient depends on whether it was used from within the ASP.NET Core pipeline or not
  • We are spending a few cycles every request to decide on whether to do anything, or potentially sending extra headers that may just get ignored
  • There are theoretical privacy concerns of correlating requests based on the trace id, outlined in the W3C Trace Context specification
  • More discussion around the behavior: HttpClient automatically adds Request-Id HTTP header #35337

For 7.0, we should decide whether injecting context is the right default for the platform.

cc: @tarekgh @noahfalk @shirhatti @davidfowl @dotnet/ncl

@MihaZupan MihaZupan added this to the 7.0.0 milestone Aug 3, 2021
@ghost
Copy link

ghost commented Aug 3, 2021

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

Issue Details

#50658 and #55556 added APIs for controlling distributed context propagation.
Part of those APIs is a CreateDefaultPropagator method that is used to seed the global static Current property.

HttpClient and ASP.NET Core both consume these APIs and as such inherit the default behavior.

CreateDefaultPropagator currently returns a LegacyPropagator, which is preserving pre-.NET 6 behavior of injecting context by default.

Having injection ON by default means some user scenarios work out of the box:

  • ASP.NET Core services will preserve the trace across process boundaries even if they haven't been explicitly instrumented for distributed tracing
  • For services that collect logs, actions performed across different services can still be attributed to a shared incoming request
  • Even when some of the services are not instrumented, others still benefit from the trace as it continues to flow

On the other hand it brings some downsides:

  • Some services are very strict about the headers they are expecting and may refuse requests that contain trace-related headers. This may be relatively difficult for users to diagnose as the behavior of HttpClient depends on whether it was used from within the ASP.NET Core pipeline or not
  • We are spending a few cycles every request to decide on whether to do anything, or potentially sending extra headers that may just get ignored
  • There are theoretical privacy concerns of correlating requests based on the trace id, outlined in the W3C Trace Context specification
  • More discussion around the behavior: HttpClient automatically adds Request-Id HTTP header #35337

For 7.0, we should decide whether injecting context is the right default for the platform.

cc: @tarekgh @noahfalk @shirhatti @davidfowl @dotnet/ncl

Author: MihaZupan
Assignees: -
Labels:

area-System.Diagnostics

Milestone: 7.0.0

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Aug 3, 2021
@tarekgh tarekgh removed the untriaged New issue has not been triaged by the area owner label Aug 3, 2021
@tommcdon tommcdon modified the milestones: 7.0.0, Future Jul 7, 2022
@tommcdon
Copy link
Member

tommcdon commented Jul 7, 2022

Moving older issues to the Future milestone as it is unlikely we will have time to address this in the .NET 7 timeframe. Please feel free to move this issue back to .NET 7 if there is active work to address the feature request.

@MihaZupan
Copy link
Member Author

Given we're not changing anything here for 7 and there appears to be no interest in doing so in the future, I'm fine with just closing this.
Feel free to reopen if you disagree.

@MihaZupan MihaZupan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants