Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `pylint` to `4.0.5`
([#4244](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4244))

### Fixed

- `opentelemetry-instrumentation-celery`: Coerce non-string header values to `str` in `CeleryGetter.get()` so context propagation does not fail when downstream libraries set non-string headers
([#4434](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4434))

### Breaking changes

- Drop Python 3.9 support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,14 @@ def get(self, carrier, key):
value = getattr(carrier, key, None)
if value is None:
return None
if isinstance(value, str) or not isinstance(value, Iterable):
value = (value,)
if isinstance(value, str):
return (value,)
if not isinstance(value, Iterable):
# Coerce non-string, non-iterable values (e.g. int from Celery
# task attributes like timelimit) to str so that propagators
# such as TraceContext don't crash with a TypeError when calling
# re.split() on the value.
return (str(value),)
return value

def keys(self, carrier):
Expand Down