-
Notifications
You must be signed in to change notification settings - Fork 635
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
Converted TextMap propagator getter to a class and added keys method #1196
Conversation
03dae3b
to
3886afb
Compare
9fc75bc
to
ee81915
Compare
...tation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
Outdated
Show resolved
Hide resolved
opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py
Outdated
Show resolved
Hide resolved
exporter/opentelemetry-exporter-datadog/tests/test_datadog_format.py
Outdated
Show resolved
Hide resolved
...on/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py
Outdated
Show resolved
Hide resolved
400d4db
to
c1e203d
Compare
c1e203d
to
1e417a8
Compare
@lzchen @owais I made code changes to implement it in the above-suggested way but I'm facing some typing errors. Currently, we have carrier defined as of type TextMapPropagatorT with no type constraints. Running a get() or keys() on this type throws typing errors because those 2 methods are defined for type Dict. details of build failure - https://github.com/open-telemetry/opentelemetry-python/pull/1196/checks?check_run_id=1231130288 should we constrain the type of TextMapPropagator in the definition? I tried doing this but its throwing errors across multiple files that use the propagator. |
8d65031
to
5a82818
Compare
5a82818
to
7c3a32c
Compare
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.
Looks good. Just need two remaining comments to be resolved.
...tation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
Outdated
Show resolved
Hide resolved
...tation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py
Outdated
Show resolved
Hide resolved
ca6ea3d
to
136eac6
Compare
from opentelemetry.trace.status import Status, StatusCanonicalCode | ||
|
||
|
||
def get_header_from_scope(scope: dict, header_name: str) -> typing.List[str]: | ||
"""Retrieve a HTTP header value from the ASGI scope. | ||
class CarrierGetter(DictGetter): |
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.
Shouldn't these be extending from Getter
instead of DictGetter
?
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.
@lzchen Extending DictGetter because of the following reasons:
- carrier is of type dict
- there is no keys implementation required here so we can use the default keys implementation in DictGetter
- if we have to extend the Getter Implementation we have to override the keys() method as well
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.
Yea, this getter is more of a specialized implementation of a dict getter so LGTM.
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.
@owais please review one final time. @nprajilesh it looks like there's some conflicts that need resolving, otherwise this is looking pretty close!
@codeboten I have resolved the conflicts. |
tried to fix a merge conflict and accidentally removed the import
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.
This is a big improvement in the code, thanks for implementing it!
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #1084
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
Checklist: