Class TraceContext
java.lang.Object
org.apache.skywalking.apm.toolkit.trace.TraceContext
Try to access the sky-walking tracer context. The context is not existed, always. only the middleware, component, or
rpc-framework are supported in the current invoke stack, in the same thread, the context will be available.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCorrelation(String key) Try to get the custom value from trace context.putCorrelation(String key, String value) Put the custom key/value into trace context.static StringTry to get the segmentId of current trace context.static intspanId()Try to get the spanId of current trace context.static StringtraceId()Try to get the traceId of current trace context.
-
Constructor Details
-
TraceContext
public TraceContext()
-
-
Method Details
-
traceId
Try to get the traceId of current trace context.- Returns:
- traceId, if it exists, or empty
String.
-
segmentId
Try to get the segmentId of current trace context.- Returns:
- segmentId, if it exists, or empty
String.
-
spanId
public static int spanId()Try to get the spanId of current trace context. The spanId is a negative number when the trace context is missing.- Returns:
- spanId, if it exists, or empty
String.
-
getCorrelation
Try to get the custom value from trace context.- Returns:
- custom data value.
-
putCorrelation
Put the custom key/value into trace context.- Returns:
- previous value if it exists.
-