-
Notifications
You must be signed in to change notification settings - Fork 606
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
Fix HTTP header normalization #2260
base: main
Are you sure you want to change the base?
Fix HTTP header normalization #2260
Conversation
...tation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
Show resolved
Hide resolved
...tation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
Show resolved
Hide resolved
Thanks for the PR @samuelcolvin. I did some digging and it looks like the OTel conventions were changed in open-telemetry/semantic-conventions#369 but used to require this normalization. We should definitely fix it, but I think it might need to be gated behind the @lmolkova @lzchen could we merge this PR today or does it need to be controlled by |
This might be a bigger discussion on how we should be handling the new http semantic convention migrations. For now, please hold off on this PR. Will bring this up in the weekly SIG. |
Running now
That SGTM as it's just a bug 👍 |
From discussion of 07/11/2024 SIG, just an update on what is blocking this PR. Some of the instrumentations that this pr touches still has not been migrated to new semantic conventions as of yet, most notably django, falcon, pyramid, starlette and tornado. Since |
Description
HTTP request and response headers (attributes
http.request.header.*
andhttp.response.header.*
) should be normalized by just being converted to lowercase, not replacing underscore with dash.This is made clear in the docs here:
You can also see the correct behavior in the go library here.
The current incorrect behavior of
replace('_', '-')
is extremely problematic since you can't know what the original header was - e.g. if you see a keyhttp.request.header.foo_bar
what was the original value? It could have beenfoo-bar
orfoo_bar
.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.