Skip to content

Commit 2c93115

Browse files
author
mriamah
committed
Refactor code
1 parent dd8ebdd commit 2c93115

File tree

1 file changed

+3
-4
lines changed
  • instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,13 @@ def set_attributes_from_context(
146146
value = "topic"
147147
break
148148

149-
# set attribute name if not set specially for a key
150-
if attribute_name is None and not new_attribute_name:
151-
attribute_name = f"celery.{key}"
152-
153149
if attribute_name:
154150
span.set_attribute(attribute_name, value)
155151
if new_attribute_name:
156152
span.set_attribute(new_attribute_name, value)
153+
# set attribute name if not set specially for a key
154+
if attribute_name is None and new_attribute_name is None:
155+
span.set_attribute(f"celery.{key}", value)
157156

158157

159158
def attach_context(

0 commit comments

Comments
 (0)