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

[otel] Add support for specifying http.route on automatic HTTP server metrics #28445

Open
lucacasonato opened this issue Mar 10, 2025 · 0 comments · May be fixed by #28476
Open

[otel] Add support for specifying http.route on automatic HTTP server metrics #28445

lucacasonato opened this issue Mar 10, 2025 · 0 comments · May be fixed by #28476
Labels

Comments

@lucacasonato
Copy link
Member

We should support users specifying the http.route and error.type attribute on automatically instrumented HTTP metrics.

To do this, I propose we copy the relevant attributes off the associated span on span completion. I suggest we do this as follows:

  • The span for the HTTP server is created in Rust (as an OtelSpan struct) and is associated with the request.
  • The span object can be exposed to JS with an op, similar to how op_http_get_request_method_and_url works. It takes the external for the HttpRequest, and returns a OtelSpan. The span is then put into AsyncContext.
  • The user can now update the span (adding http.route, error.type, etc).
  • When the response is finalized, we read the attributes relevant to the metric we'd like to record, in Rust, from the span.
@lucacasonato lucacasonato mentioned this issue Mar 10, 2025
11 tasks
@lucacasonato lucacasonato changed the title [ote] Add support for specifying http.route on automatic HTTP server metrics [otel] Add support for specifying http.route on automatic HTTP server metrics Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant