tower-rs / tower-http

HTTP specific Tower utilities.
702 stars 165 forks source link

Include grpc error message in tracing #422

Open xiaoyawei opened 1 year ago

xiaoyawei commented 1 year ago

Motivation

Currently the tracing middleware only captures the gRPC status code when extracting the error out of a http response. Besides the code, gRPC also requires a human-readable message for error handling, and it'll be useful in this message is extracted from the response as well.

Solution

Per gRPC over HTTP/2 Protocol, a percent-encoded message is included in grpc-message field in the response header / trailer. So this PR also extracts this value and include it in the extracted GrpcFailureClass, such that the downstream usages can use this message for tracing.