def get_context() -> SpanContext: if not hasattr(_thread_local, 'context'): _thread_local.context = None _thread_local.context = _thread_local.context or ( SpanContext() if agent.connected() else NoopContext()) return _thread_local.context
def get_context() -> SpanContext: spans = _spans() if spans: return spans[len(spans) - 1].context return SpanContext() if agent.connected() else NoopContext()
def get_context() -> SpanContext: local = _local() context = getattr(local, 'context', False) if not context: context = local.context = (SpanContext() if agent.connected() else NoopContext()) _spans_set([]) # XXX would be better in SpanContext.__init__() but for some reason doesn't work there return context
def get_context() -> SpanContext: _thread_local.context = _thread_local.context or (SpanContext() if agent.connected() else NoopContext()) return _thread_local.context