question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TraceId is not propageted when using dapr grpc client's InvokeMethodAsync method

See original GitHub issue

It seems that the W3C trace headers in dapr grpc calls are not propagated correctly.

I have a simple API Gateway where the W3C Activity format is specified like:

Activity.DefaultIdFormat = ActivityIdFormat.W3C;

The API Gateway is executing subsequent calls to several microservices, either via dapr http/grpc or vanilla grpc with generated proto files from .net (no dapr is involved).

Expected Behavior

If I execute a call via Rest to the ApiGateway–>Dapr–>REST-WeatherMicroservice as shown in the below log: image The Trace Id is propagated correctly and the request correlation can be made.

If I execute a call via Rest to the ApiGateway–>Vanilla Grpc–>Grpc-WeatherMicroservice as shown in the below log: image The Trace Id is propagated correctly and the request correlation can be made.

Actual Behavior

If I execute a call via Rest to the ApiGateway–>Dapr–>Grpc-WeatherMicroservice as shown in the below log: image The Trace Id is broken and Dapr generates a new TraceId which breaks the request correlation.

Steps to Reproduce the Problem

See example project: https://gitlab.com/quickstar1/microservice-prototype

Release Note

RELEASE NOTE:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rynowakcommented, Jan 29, 2021

thanks @quickstar - I was able to reproduce this issue using the Dapr v1.0.0-rc3 runtime and v1.0.0-rc2 SDK. There are some changes to how these APIs behave in RC3 but nothing that should impact tracing.

What’s happening here is that the grpc-trace-bin metadata is being passed (but not traceparent) when Dapr invokes a gRPC server. ASP.NET Core has no understanding of grpc-trace-bin, and doesn’t populate an activity based on it.

Here’s basically what happens:

browser ->
API Gateway (T1) // The api gateway doesn't see a value for traceparent and so it generates a new trace ID
API Gateway Dapr Sidecar (T1) // Sees the traceparent value and forwards it
Weather Dapr Sidecar (T1) // Sees the traceparent value and forwards it as grpc-trace-bin
Weather (T2) // Doesn't see a value for traceparent so it generates a new trace ID
0reactions
pkedycommented, Mar 5, 2021

Hey @quickstar, the link to your example project is giving me a 404. Can you double check the permissions on it? I’d like to use it to validate the potential fix I have. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How-To: Invoke services using gRPC
This Go app implements the Greeter proto service and exposes a SayHello method. Run the gRPC server using the Dapr CLI. dapr run...
Read more >
How-To: Use W3C trace context with Dapr
You need to use http/gRPC clients to propagate and retrieve trace headers through http headers and gRPC metadata. Retrieve trace context in Go....
Read more >
How-To: Invoke services using HTTP | Dapr Docs
Call between services using service invocation. ... Build(); //Using Dapr SDK to invoke a method var result = client.CreateInvokeMethodRequest(HttpMethod.
Read more >
DaprClient usage
Essential tips and advice for using DaprClient.
Read more >
How to: Use the gRPC interface in your Dapr application
Now you can explore all the different methods on the Dapr client. Create a gRPC app with Dapr. The following steps will show...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found