Skip to content

Commit 26a551d

Browse files
committed
fix(celery): coerce timelimit values to strings in span attributes
When only one of the two time limits is set (e.g. soft_time_limit=42 but no time_limit), the None replacement produced a mixed-type list ["", 42] which triggers an OTel mixed-type attribute warning. Coerce all values to strings for consistency. See #2022
1 parent 822cd77 commit 26a551d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery

instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def set_attributes_from_context(span, context):
7676
if value in [(None, None), [None, None]]:
7777
continue
7878
if None in value:
79-
value = ["" if tl is None else tl for tl in value]
79+
value = ["" if tl is None else str(tl) for tl in value]
8080

8181
# Skip `retries` if it's value is `0`
8282
if key == "retries" and value == 0:

0 commit comments

Comments
 (0)