opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

Adding gRPC instrumentation but not HttpClient causes issues with parenting

Open alanwest opened this issue 4 years ago • 3 comments

Both the gRPC .NET and HttpClient libraries generate their own Activity for outgoing calls.

gRPC .NET uses HttpClient behind the scenes, so when you configure OpenTelemetry with both gRPC and HttpClient instrumentation you'll see that the Activity generated by gRPC is the parent of the Activity generated by HttpClient.

However, if you only include gRPC instrumentation or if you only include HttpClient instrumentation the chain of parenting can become broken since the library still generates their respective Activity. Another way this can occur is if you add both gRPC and HttpClient instrumentation, but you configure SuppressDownstreamInstrumentation for the gRPC instrumentation thereby excluding the child HttpClient Activity from the trace.

This issue is somewhat related to #1217 in that the general issue is that libraries generate Activities regardless of whether OpenTelemetry has been configured to be interested in them. I'm not sure there are good answers here, but it would be nice if there were a way to inform a library of whether or not to generate Activities based on how OpenTelemetry is configured for an app.

alanwest avatar Sep 24 '20 18:09 alanwest