public class ContextManager extends Object implements BootService
ContextManager controls the whole context of TraceSegment. Any TraceSegment relates to
single-thread, so this context use ThreadLocal to maintain the context, and make sure, since a TraceSegment starts, all ChildOf spans are in the same context. What is 'ChildOf'? https://github.com/opentracing/specification/blob/master/specification.md#references-between-spans
Also, ContextManager delegates to all AbstractTracerContext's major methods.
| Constructor and Description |
|---|
ContextManager() |
| Modifier and Type | Method and Description |
|---|---|
static AbstractSpan |
activeSpan()
If not sure has the active span, use this method, will be cause NPE when has no active span,
use ContextManager::isActive method to determine whether there has the active span.
|
static AbstractTracerContext |
awaitFinishAsync(AbstractSpan span) |
void |
boot() |
static ContextSnapshot |
capture() |
static void |
continued(ContextSnapshot snapshot) |
static AbstractSpan |
createEntrySpan(String operationName,
ContextCarrier carrier) |
static AbstractSpan |
createExitSpan(String operationName,
ContextCarrier carrier,
String remotePeer) |
static AbstractSpan |
createExitSpan(String operationName,
String remotePeer) |
static AbstractSpan |
createLocalSpan(String operationName) |
static void |
extract(ContextCarrier carrier) |
static String |
getGlobalTraceId() |
static RuntimeContext |
getRuntimeContext() |
static void |
inject(ContextCarrier carrier) |
static boolean |
isActive() |
void |
onComplete() |
void |
prepare() |
void |
shutdown() |
static void |
stopSpan()
Recommend use ContextManager::stopSpan(AbstractSpan span), because in that way,
the TracingContext core could verify this span is the active one, in order to avoid stop unexpected span.
|
static void |
stopSpan(AbstractSpan span) |
public static String getGlobalTraceId()
public static AbstractSpan createEntrySpan(String operationName, ContextCarrier carrier)
public static AbstractSpan createLocalSpan(String operationName)
public static AbstractSpan createExitSpan(String operationName, ContextCarrier carrier, String remotePeer)
public static AbstractSpan createExitSpan(String operationName, String remotePeer)
public static void inject(ContextCarrier carrier)
public static void extract(ContextCarrier carrier)
public static ContextSnapshot capture()
public static void continued(ContextSnapshot snapshot)
public static AbstractTracerContext awaitFinishAsync(AbstractSpan span)
public static AbstractSpan activeSpan()
public static void stopSpan()
public static void stopSpan(AbstractSpan span)
public void prepare()
throws Throwable
prepare in interface BootServiceThrowablepublic void boot()
boot in interface BootServicepublic void onComplete()
throws Throwable
onComplete in interface BootServiceThrowablepublic void shutdown()
throws Throwable
shutdown in interface BootServiceThrowablepublic static boolean isActive()
public static RuntimeContext getRuntimeContext()
Copyright © 2019 The Apache Software Foundation. All rights reserved.