You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the Server::trace_fn method allows a span to be created for each request being serviced, there is not enough information to create the span with meaningful data. For example, I would like to name the span after the request path to identify which service method is being invoked. However, trace_fn only has access to the headers, which don't contain this data. If trace_fn was instead passed the entire request, the request path (and a lot more) would be available for span construction.
Proposal
trace_fn should be invoked with the entire request, not just the headers. Unfortunately, this will require an API change.
Alternatives
I haven't attempted it, but it should be possible to use a full-blown interceptor as an alternative, albeit with a lot more work.
The text was updated successfully, but these errors were encountered:
I wonder if there is a reason the API wasn't designed like that to begin with 🤔 Could just be an oversight in which case I think it would be a good change.
I haven't attempted it, but it should be possible to use a full-blown interceptor as an alternative, albeit with a lot more work.
I don't think its possible to do with interceptors as they can only return new requests. There isn't a way for an interceptor to return a span to tonic for it to manage.
I think it would be possible using tower to make a middleware that creates a span an manages it itself but it would require quite a bit of boilerplate.
Feature Request
Crates
tonic
Motivation
While the
Server::trace_fn
method allows a span to be created for each request being serviced, there is not enough information to create the span with meaningful data. For example, I would like to name the span after the request path to identify which service method is being invoked. However,trace_fn
only has access to the headers, which don't contain this data. Iftrace_fn
was instead passed the entire request, the request path (and a lot more) would be available for span construction.Proposal
trace_fn
should be invoked with the entire request, not just the headers. Unfortunately, this will require an API change.Alternatives
I haven't attempted it, but it should be possible to use a full-blown interceptor as an alternative, albeit with a lot more work.
The text was updated successfully, but these errors were encountered: