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

Allow to pass W3C trace header or grpc-trace-bin to dapr api call #300

Closed
youngbupark opened this issue May 4, 2020 · 5 comments
Closed
Labels

Comments

@youngbupark
Copy link

Describe the proposal

Allow to pass W3C trace header(traceparent) or grpc-trace-bin to dapr api call.

0.7.0 supports traceparent and grpc-trace-bin. Dotnet-sdk needs the way to pass traceparent for http or grpc-trace-bin metadata for grpc.

@youngbupark
Copy link
Author

@shalabhms @amanbha @LMWF It would be good to think about how to allow users to use their own trace id in dotnet-sdk, but I understand there were no strong requests from customers.

@rynowak
Copy link
Collaborator

rynowak commented May 13, 2020

.NET Core 3.0+ will propagate the W3C header format by default if the appropriate headers are set on the inbound request. It's also a good idea overall to add the guidance to set this property to the W3C value in Main() if you're using W3C tracing - this way we create a new trace ID for the request in the correct format if one wasn't passed in.

  • Request comes in: ASP.NET Core parses the header and sets Activity.Current
  • Activities are ambient (like thread-local but async-aware) so once its set by the server it's applied to all processing triggered from that request.
  • HttpClient knows about Activity.Current and will automatically apply the headers to any outbound calls if the ID is set.

If you want to customize the ID then typically I think you'd set HttpContext.TraceIdentifier as well as Activity.Current.Id. I'm not sure if we have to do anything here specially because we're doing gRPC.

This whole flow should be fairly automatic since these features are built-in to .NET as a platform. I'm surprised if it's not already working 😆

/cc @noahfalk @shirhatti @JamesNK

@LMWF
Copy link
Contributor

LMWF commented Jul 21, 2020

Need to validate

@LMWF LMWF added the P1 label Jul 21, 2020
@shalabhms
Copy link
Contributor

Need to validate

@LMWF , this has been validated . Need to have workaround fix dapr/dapr#1816 for the scenario to work. You can find the zipkin trace image for the test in the PR.

@amanbha
Copy link
Contributor

amanbha commented Aug 4, 2020

dapr runtime added a workaround until grpc-dotnet client is fixed.

@amanbha amanbha closed this as completed Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants