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

Reimplement the keys method in WSGI CarrierGetter #379

Merged
merged 3 commits into from
Mar 25, 2021
Merged

Reimplement the keys method in WSGI CarrierGetter #379

merged 3 commits into from
Mar 25, 2021

Conversation

marcinzaremba
Copy link
Contributor

@marcinzaremba marcinzaremba commented Mar 25, 2021

Description

Implements keys method in WSGI CarrierGetter (previously a static, empty list was returned)

Fixes #376

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

See the unit test added in this PR.

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@marcinzaremba marcinzaremba marked this pull request as ready for review March 25, 2021 11:21
@marcinzaremba marcinzaremba requested review from a team, codeboten and hectorhdzg and removed request for a team March 25, 2021 11:21
key[_CARRIER_KEY_PREFIX_LEN:].lower().replace("_", "-")
for key in carrier
if key.startswith(_CARRIER_KEY_PREFIX)
]
Copy link
Contributor

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?

Copy link
Contributor Author

@marcinzaremba marcinzaremba Mar 25, 2021

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:


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.

Copy link
Contributor

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.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codeboten codeboten merged commit 795bc86 into open-telemetry:main Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WSGI Carrier Getter always returns an empty list as keys
3 participants