hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
10k stars 1.01k forks source link

How to get grpc-status in Layer? #1824

Open njskalski opened 3 months ago

njskalski commented 3 months ago

Hi,

I implemented a Layer similar to this one https://docs.rs/tonic-tracing-opentelemetry/0.19.0/src/tonic_tracing_opentelemetry/middleware/server.rs.html , and I want to access "grpc-status" field that is not among the headers, it seems to be added later from "trailers".

Is there a way to either read it earlier OR trigger an action when it's available?

DoumanAsh commented 2 months ago

You should be able to access in response only so you need to wrap service's response with your own future