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

Implement url.scheme attribute label for Opentelemetry compliance #8

Open
francoposa opened this issue Oct 3, 2024 · 0 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@francoposa
Copy link
Owner

https://opentelemetry.io/docs/specs/semconv/http/http-metrics/#http-server

  • url.scheme
  • string
  • The URI scheme component identifying the used protocol. [2]
  • http; https
  • Required
    [2]: The scheme of the original client request, if known (e.g. from Forwarded#proto, X-Forwarded-Proto, or a similar header). Otherwise, the scheme of the immediate peer request.

Since generally in any modern environment the webserver app is not going to be terminating TLS itself, the spec tells us to lean on the X-Forwarded-Proto and Forwarded headers for the information.

The middleware needs to:

  • parse each header to get the protocol out of it
  • assign the result to url.scheme attribute label on each request

The docs do not explicitly say this but I would assume we should give precedence to Forwarded since it is a real standard, while X-Forwarded-Proto is a "de-facto standard" which seems unlikely to ever be promoted from that status, as Forwarded covers the same info.

Given that this is an HTTP server middleware, we can fall back to http or just splitting it from the URL if it's not present in the headers, as described: Otherwise, the scheme of the immediate peer request.

@francoposa francoposa added enhancement New feature or request good first issue Good for newcomers labels Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant