public class ActiveSpan
extends java.lang.Object
Constructor and Description |
---|
ActiveSpan() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> |
baggageItems()
Get all baggage items propagating with the currently active OpenTracing SpanContext (if there
is one).
|
static io.opentracing.Span |
get()
Get the currently active OpenTracing Span (if there is one).
|
static java.lang.String |
getBaggageItem(java.lang.String key)
Get a baggage item from the currently active OpenTracing Span (if there is one).
|
static io.opentracing.SpanContext |
getContext()
Get the currently active OpenTracing SpanContext (if there is one).
|
static void |
log(java.util.Map<java.lang.String,?> fields)
Log key:value pairs to the currently active OpenTracing Span (if there is one).
|
static void |
log(java.lang.String event)
Log an event to the currently active OpenTracing Span (if there is one).
|
static void |
setBaggageItem(java.lang.String key,
java.lang.String value)
Attach a baggage item to the currently active OpenTracing Span (if there is one).
|
public static io.opentracing.Span get()
Returns null if there is no active Span. See also the log and baggage methods, which only log or attach if there is a non-null active Span.
log(Map)
,
log(String)
,
setBaggageItem(String, String)
,
getBaggageItem(String)
public static io.opentracing.SpanContext getContext()
Returns null if there is no active SpanContext.
public static void log(java.util.Map<java.lang.String,?> fields)
fields
- key:value log fieldspublic static void log(java.lang.String event)
event
- the event valuepublic static void setBaggageItem(java.lang.String key, java.lang.String value)
Note: The baggage key is case-insensitive.
Note: Baggage is propagated with subsequent local and remote calls, so this feature must be used with care. Baggage is only propagated to the future children of this Span.
key
- the (case-insenstive) key for this baggage itemvalue
- the value for this baggage itempublic static java.lang.String getBaggageItem(java.lang.String key)
Note: The baggage key is case-insensitive.
Returns null if there is no such item for the key, or if there is no active Span.
key
- the (case-insenstive) key associated with the baggage itempublic static java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> baggageItems()
setBaggageItem(String, String)
,
getBaggageItem(String)
Cinnamon API. Copyright (c) 2015–2021 Lightbend.