Skip to content

Commit 1e9bf78

Browse files
committed
If not tracing, don't trace.
1 parent edc88e7 commit 1e9bf78

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

instana/instrumentation/urllib3.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77

88
@wrapt.patch_function_wrapper('urllib3', 'PoolManager.urlopen')
99
def urlopen_with_instana(wrapped, instance, args, kwargs):
10+
context = instana.internal_tracer.current_context()
11+
12+
# If we're not tracing, just return
13+
if context is None:
14+
return wrapped(*args, **kwargs)
15+
1016
try:
11-
context = instana.internal_tracer.current_context()
1217
span = instana.internal_tracer.start_span("urllib3", child_of=context)
1318
span.set_tag(ext.HTTP_URL, args[1])
1419
span.set_tag(ext.HTTP_METHOD, args[0])

0 commit comments

Comments
 (0)