Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrument HTTP requests & responses #681

Open
Mirko-von-Leipzig opened this issue Feb 11, 2025 · 2 comments
Open

Instrument HTTP requests & responses #681

Mirko-von-Leipzig opened this issue Feb 11, 2025 · 2 comments
Assignees
Labels
telemetry Relates to tracing and open-telemetry
Milestone

Comments

@Mirko-von-Leipzig
Copy link
Contributor

Mirko-von-Leipzig commented Feb 11, 2025

Currently remote context is handled via gRPC middleware which does not have access to the http request, only the gRPC metadata. This means that we cannot trace client/server IP or other nice to have http data.

See here for context, but it will likely include switching to a tower layer instead. Consider simplifying the RPC span creation as well, as mentioned here.

Also see the open-telemetry standard on what to consider including as additional metadata.

@bobbinth bobbinth added this to the v0.9 milestone Feb 11, 2025
@Mirko-von-Leipzig Mirko-von-Leipzig added the telemetry Relates to tracing and open-telemetry label Feb 13, 2025
@sergerad
Copy link

Hey @Mirko-von-Leipzig just checking my understanding that the main unlock here would be to leverage an impl like this on the server so as to get HTTP metadata via http::Request type and potentially the body via the generic ReqBody: Send + 'static, (e.g. + Display or + Debug)? TY

@Mirko-von-Leipzig
Copy link
Contributor Author

@sergerad I haven't dug in too deeply, my current knowledge is mostly based on tonic's Interceptor docs:

If you need more powerful middleware, tower is the recommended approach. You can find examples of how to use tower with tonic here.

Additionally, interceptors is not the recommended way to add logging to your service. For that a tower middleware is more appropriate since it can also act on the response. For example tower-http’s Trace middleware supports gRPC out of the box.

I know tower has built-in grpc-tracing support but that is just some default implementation based on gRPC headers.

We probably need to customise things, in which case I believe the trace is the next level of abstraction. Hopefully this is enough, though maybe we have to drop down to the example you've linked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
telemetry Relates to tracing and open-telemetry
Projects
None yet
Development

No branches or pull requests

3 participants