Skip to content

Commit ab4afdb

Browse files
committed
Return context only if we're tracing.
1 parent 1e9bf78 commit ab4afdb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

instana/tracer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ def start_span(
6969
return self.current_span
7070

7171
def current_context(self):
72-
return self.current_span.context
72+
context = None
73+
if self.current_span:
74+
context = self.current_span.context
75+
return context
7376

7477
def inject(self, span_context, format, carrier):
7578
if format in self._propagators:

0 commit comments

Comments
 (0)