From f1b20af7a8921f9a4d2458dcdbcaf166adb4efd2 Mon Sep 17 00:00:00 2001 From: Martin Ringehahn Date: Tue, 28 May 2019 14:13:50 -0400 Subject: [PATCH] fix documentation for current_root_span the function may return `None`. guard against that in the example --- ddtrace/tracer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ddtrace/tracer.py b/ddtrace/tracer.py index ce5088137d6..55f0c7fbd5e 100644 --- a/ddtrace/tracer.py +++ b/ddtrace/tracer.py @@ -387,7 +387,8 @@ def current_root_span(self): # get the root span root_span = tracer.current_root_span() # set the host just once on the root span - root_span.set_tag('host', '127.0.0.1') + if root_span: + root_span.set_tag('host', '127.0.0.1') """ ctx = self.get_call_context() if ctx: