Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.
- python 3.9.9
- celery 5.3.4 and celery 4.4.2
Steps to reproduce
Describe exactly how to reproduce the error. Include a code sample if applicable.
-
create file tasks.py
from celery import Celery
app = Celery('tasks', broker='pyamqp://guest@localhost//')
@app.task(soft_time_limit=42)
def add(x, y):
return x + y
-
start broker:
OTEL_METRICS_EXPORTER=none OTEL_TRACES_EXPORTER=console opentelemetry-instrument celery -A tasks worker --loglevel=INFO
-
run a task:
$ python
Python 3.9.9 (main, Apr 13 2022, 11:57:59)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tasks import add
>>> from datetime import datetime
>>> add.apply_async(('',''), eta=datetime.utcnow())
<AsyncResult: c4a1673d-a09a-4462-9238-fb6199d0ace1>
>>>
-
observe warning
[2023-10-26 17:45:57,289: WARNING/ForkPoolWorker-8] Attribute 'celery.timelimit' mixes types str and int in attribute value sequence
What is the expected behavior?
What did you expect to see?
To not see a warning
What is the actual behavior?
What did you see instead?
I am observing a warning "Attribute 'celery.timelimit' mixes types str and int in attribute value sequence" from OTEL when setting soft_timie_limit
I am observing a warning "Attribute 'celery.timelimit' mixes types int and str in attribute value sequence" from OTEL when setting time_limit
Additional context
Add any other context about the problem here.
I have debugged and logged some values from
|
if key == "timelimit": |
|
if value in [(None, None), [None, None]]: |
|
continue |
|
if None in value: |
|
value = ["" if tl is None else tl for tl in value] |
I see that
values is actually
[None, 42] (None and a number) which makes this code
|
if None in value: |
|
value = ["" if tl is None else tl for tl in value] |
to produce
[str, int] and trigger a warning from
https://github.com/open-telemetry/opentelemetry-python/blob/34d11d59e9b37052eb3aa6706288641ecb3056e7/opentelemetry-api/src/opentelemetry/attributes/__init__.py#L86-L93
Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.
Steps to reproduce
Describe exactly how to reproduce the error. Include a code sample if applicable.
create file
tasks.pystart broker:
run a task:
observe warning
What is the expected behavior?
What did you expect to see?
To not see a warning
What is the actual behavior?
What did you see instead?
I am observing a warning "Attribute 'celery.timelimit' mixes types str and int in attribute value sequence" from OTEL when setting
soft_timie_limitI am observing a warning "Attribute 'celery.timelimit' mixes types int and str in attribute value sequence" from OTEL when setting
time_limitAdditional context
Add any other context about the problem here.
I have debugged and logged some values from
opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py
Lines 65 to 69 in 6f3aead
valuesis actually[None, 42](None and a number) which makes this codeopentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py
Lines 68 to 69 in 6f3aead
[str, int]and trigger a warning fromhttps://github.com/open-telemetry/opentelemetry-python/blob/34d11d59e9b37052eb3aa6706288641ecb3056e7/opentelemetry-api/src/opentelemetry/attributes/__init__.py#L86-L93