Describe your environment
Currently, the celery task that is executing gets the context from the headers, and attaches it to the new span:
|
token = context_api.attach(tracectx) if tracectx is not None else None |
|
|
|
logger.debug("prerun signal start task_id=%s", task_id) |
|
|
|
operation_name = f"{_TASK_RUN}/{task.name}" |
|
span = self._tracer.start_span( |
|
operation_name, context=tracectx, kind=trace.SpanKind.CONSUMER |
|
) |
I don't think this is the correct behavior. It should actually be a span link - according to the docs:
Links exist so that you can associate one span with one or more spans, implying a causal relationship. For example, let’s say we have a distributed system where some operations are tracked by a trace.
Which is exactly this case.
When a web framework triggers a celery task, it shouldn't be on the same trace. It's already a new one... But they are linked through the span link.
Would you like to implement a fix?
Yes
Describe your environment
Currently, the celery task that is executing gets the context from the headers, and attaches it to the new span:
opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py
Lines 173 to 180 in e3ba54b
I don't think this is the correct behavior. It should actually be a span link - according to the docs:
Which is exactly this case.
When a web framework triggers a celery task, it shouldn't be on the same trace. It's already a new one... But they are linked through the span link.
Would you like to implement a fix?
Yes