From a92816a8bc98f6ec3d683849eda0f2357077ccc5 Mon Sep 17 00:00:00 2001 From: Malcolm <9681621+malcolmrebughini@users.noreply.github.com> Date: Tue, 21 May 2024 17:58:58 -0700 Subject: [PATCH] fix(opentelemetry-instrumentation-celery): attach context only if it is not None --- .../src/opentelemetry/instrumentation/celery/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py b/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py index 92423d7592..39b3bffe60 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py @@ -170,7 +170,7 @@ def _trace_prerun(self, *args, **kwargs): self.update_task_duration_time(task_id) request = task.request tracectx = extract(request, getter=celery_getter) or None - token = context_api.attach(tracectx) + token = context_api.attach(tracectx) if tracectx is not None else None logger.debug("prerun signal start task_id=%s", task_id)