Skip to content

Commit 5b70387

Browse files
Add span.is_recording check
1 parent fd14f5c commit 5b70387

File tree

1 file changed

+3
-2
lines changed
  • instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy

1 file changed

+3
-2
lines changed

instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ def _wrap_connect_internal(func, module, args, kwargs):
9292
with tracer.start_as_current_span(
9393
"connect", kind=trace.SpanKind.CLIENT
9494
) as span:
95-
attrs, _ = _get_attributes_from_url(module.url)
96-
span.set_attributes(attrs)
95+
if span.is_recording():
96+
attrs, _ = _get_attributes_from_url(module.url)
97+
span.set_attributes(attrs)
9798
return func(*args, **kwargs)
9899

99100
return _wrap_connect_internal

0 commit comments

Comments
 (0)