open-telemetry / opentelemetry-dotnet-contrib

This repository contains set of components extending functionality of the OpenTelemetry .NET SDK. Instrumentation libraries, exporters, and other components can find their home here.
https://opentelemetry.io
Apache License 2.0
460 stars 272 forks source link

Record exceptions in gRPC request handling #1743

Open Haydabase opened 3 years ago

Haydabase commented 3 years ago

Feature Request

Is your feature request related to a problem?

The instrumentation library for AspNetCore records unhandled exceptions during handling of HTTP requests, adding them as an event to the Activity, and calling the configured Enrich action with an "OnException" event. The same is not true for exceptions thrown during gRPC request handling, as these are swallowed by ServerCallHandlerBase in the Grpc.AspNetCore library.

Describe the solution you'd like:

Record exceptions thrown thrown during gRPC request handling if EnableGrpcAspNetCoreSupport is true:

This will likely require some diagnostic events to be emitted from the HttpContextServerCallContext in the Grpc.AspNetCore library.

Describe alternatives you've considered.

One work around is to do record the exception and enrich the Activity in a gRPC interceptor, but seems unnecessary boilerplate, requiring separate configuration, in order to bring the features of gRPC tracing up to parity with regular HTTP tracing.

scalalang2 commented 11 months ago

It seems no one has taken this issue.