Skip to content

Record exceptions in gRPC request handling #1743

Open
@Haydabase

Description

@Haydabase

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:

  • Add an event to the Activity.
  • Call Enrich with an "OnException" event.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions