-
Notifications
You must be signed in to change notification settings - Fork 621
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
Reimplement the keys method in WSGI CarrierGetter #379
Reimplement the keys method in WSGI CarrierGetter #379
Conversation
key[_CARRIER_KEY_PREFIX_LEN:].lower().replace("_", "-") | ||
for key in carrier | ||
if key.startswith(_CARRIER_KEY_PREFIX) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, did this prevent or limit propagation in some way when it was implemented as an empty list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It prevents any use case when information to be extracted is not known beforehand (for example HTTP headers starting with a particular prefix, but with unknown exact names). The great example is OT Trace Propagator, where the current implementation (empty list) renders injecting baggage unusable:
Line 92 in f8e51c4
for key in getter.keys(carrier): |
On the other hand when carrier would be manipulated directly, it would shift a specific implementation of keys translation (from uppercase, environ-like WSGI format) to every consumer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The great example is OT Trace Propagator, where the current implementation (empty list) renders injecting baggage unusable:
Thanks. This is what I was interested in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
Implements keys method in WSGI CarrierGetter (previously a static, empty list was returned)
Fixes #376
Type of change
How Has This Been Tested?
See the unit test added in this PR.
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.