From 03cf262a21aee2e1bec236ca866df06d0c41d5d5 Mon Sep 17 00:00:00 2001 From: "Tahir H. Butt" Date: Mon, 15 Jun 2020 09:51:33 -0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Diego Hurtado --- .../src/opentelemetry/ext/celery/__init__.py | 2 +- .../src/opentelemetry/ext/celery/utils.py | 4 ++-- tox.ini | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/opentelemetry-ext-celery/src/opentelemetry/ext/celery/__init__.py b/ext/opentelemetry-ext-celery/src/opentelemetry/ext/celery/__init__.py index 09af1ac98dc..7648da53a02 100644 --- a/ext/opentelemetry-ext-celery/src/opentelemetry/ext/celery/__init__.py +++ b/ext/opentelemetry-ext-celery/src/opentelemetry/ext/celery/__init__.py @@ -15,7 +15,7 @@ Instrument `celery`_ to report Celery APP operations. There are two options for instrumenting code. The first option is to use the -``opentelemetry-auto-instrumentation`` executable which will automatically +``opentelemetry-instrument`` executable which will automatically instrument your Celery APP. The second is to programmatically enable instrumentation as explained in the following section. diff --git a/ext/opentelemetry-ext-celery/src/opentelemetry/ext/celery/utils.py b/ext/opentelemetry-ext-celery/src/opentelemetry/ext/celery/utils.py index 2aa7fb301fd..549a87d98a4 100644 --- a/ext/opentelemetry-ext-celery/src/opentelemetry/ext/celery/utils.py +++ b/ext/opentelemetry-ext-celery/src/opentelemetry/ext/celery/utils.py @@ -67,7 +67,7 @@ def set_attributes_from_context(span, context): if key == "delivery_info": # Get also destination from this routing_key = value.get("routing_key") - if routing_key: + if routing_key is not None: span.set_attribute("messaging.destination", routing_key) value = str(value) @@ -154,7 +154,7 @@ def retrieve_task_id(context): """ headers = context.get("headers") body = context.get("body") - if headers: + if headers is not None: # Protocol Version 2 (default from Celery 4.0) return headers.get("id") # Protocol Version 1 diff --git a/tox.ini b/tox.ini index d46de2b3474..30a29565e9a 100644 --- a/tox.ini +++ b/tox.ini @@ -193,7 +193,7 @@ commands_pre = getting-started: pip install -e {toxinidir}/opentelemetry-auto-instrumentation -e {toxinidir}/ext/opentelemetry-ext-requests -e {toxinidir}/ext/opentelemetry-ext-wsgi -e {toxinidir}/ext/opentelemetry-ext-flask - celery: pip install {toxinidir}/opentelemetry-auto-instrumentation + celery: pip install {toxinidir}/opentelemetry-instrument celery: pip install {toxinidir}/ext/opentelemetry-ext-celery[test] grpc: pip install {toxinidir}/ext/opentelemetry-ext-grpc[test]