Skip to content

OT Trace propagator fails with exception when no headers are present #377

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

Closed
marcinzaremba opened this issue Mar 24, 2021 · 0 comments · Fixed by #378
Closed

OT Trace propagator fails with exception when no headers are present #377

marcinzaremba opened this issue Mar 24, 2021 · 0 comments · Fixed by #378
Labels
bug Something isn't working

Comments

@marcinzaremba
Copy link
Contributor

marcinzaremba commented Mar 24, 2021

Describe your environment
Latest version (main branch) of both opentelemetry-python and opentelemetry-python-contrib

Steps to reproduce

from opentelemetry.propagators.ot_trace import OTTracePropagator
from opentelemetry.propagators.textmap import DictGetter

getter = DictGetter()
carrier = {}

propagator = OTTracePropagator()
propagator.extract(getter, carrier)

results in:

Traceback (most recent call last):
  File "repro.py", line 8, in <module>
    propagator.extract(getter, {})
  File "(...)/opentelemetry-python-contrib/propagator/opentelemetry-propagator-ot-trace/src/opentelemetry/propagators/ot_trace/__init__.py", line 76, in extract
    and _valid_extract_traceid.fullmatch(traceid) is not None
TypeError: expected string or bytes-like object

What is the expected behavior?
Propagator extraction returns an unmodified context due to lack of relevant headers in the carrier.

If a value can not be parsed from the carrier, for a cross-cutting concern, the implementation MUST NOT throw an exception and MUST NOT store a new value in the Context, in order to preserve any previously existing valid value.

from OTel specification

What is the actual behavior?
Propagator extraction fails with an exception when no headers are present in the carrier.

Additional context
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant