public interface Span
Tracing span. A span is started by 
Span.Builder.start() and ended by either
 end() or end(Throwable).
 You can obtain SpanContext from context().
 Span is the base reporting unit of tracing. Spans can have a parent (Span.Builder.parent(SpanContext),
 you can add tag(Tag) to it, and you can log addEvent(String, java.util.Map).- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceSpan.Builder<B extends Span.Builder<B>>Fluent API builder to create a newSpan.static enumSpan kind.static enumSpan status.
- 
Method SummaryModifier and TypeMethodDescriptionactivate()Make this span the current active span.default voidAdd a new event to this span.voidAdd an event to this span.baggage()Returns writable baggage associated with this span.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Usebaggage()and thenWritableBaggage.set(String, String)}.context()Span context can be used to configure a span parent, as is used when a span reference is needed, without the possibility to end such a span.current()Provide current span if one is available.voidend()End this span (finish processing) using current timestamp.voidEnd with error status and an exception.default voidEnd this span using the provided timestamp.default voidEnd this span with an error status using the provided ending time and throwable.voidstatus(Span.Status status) Span status, mostly used to configureSpan.Status.ERROR.default SpanAdd a tag to this span.Add a boolean tag.Add a numeric tag.Add a string tag.default <T> TAccess the underlying span by specific type.
- 
Method Details- 
currentProvide current span if one is available. This is using a thread local, so it may provide unexpected results in a reactive environment. Please use request methods to obtain request span in Reactive Web Server.- Returns:
- current span or empty optional if there is no current span
- See Also:
 
- 
tagAdd a tag to this span.- Parameters:
- tag- tag to add
- Returns:
- current span
 
- 
tagAdd a string tag.- Parameters:
- key- tag key
- value- tag value
- Returns:
- current span
 
- 
tagAdd a boolean tag.- Parameters:
- key- tag key
- value- tag value
- Returns:
- current span
 
- 
tagAdd a numeric tag.- Parameters:
- key- tag key
- value- tag value
- Returns:
- current span
 
- 
statusSpan status, mostly used to configureSpan.Status.ERROR.- Parameters:
- status- status to set
 
- 
contextSpanContext context()Span context can be used to configure a span parent, as is used when a span reference is needed, without the possibility to end such a span.- Returns:
- context of this span
 
- 
addEventAdd an event to this span.- Parameters:
- name- name of the event
- attributes- event attributes to be recorded
 
- 
endvoid end()End this span (finish processing) using current timestamp.
- 
endEnd this span using the provided timestamp.- Parameters:
- timestamp- end time for the span
 
- 
endEnd this span with an error status using the provided ending time and throwable. Sets the span status toSpan.Status.ERRORand adds appropriate tags and events to report the error.- Parameters:
- timestamp- end time for the span
- t- throwable causing the span to end
 
- 
endEnd with error status and an exception. Configures status toSpan.Status.ERROR, and adds appropriate tags and events to report this exception.- Parameters:
- t- throwable that caused the error status
 
- 
activateScope activate()Make this span the current active span. This is expected to use thread locals and as such is not suitable for reactive environment.- Returns:
- current scope
 
- 
baggageDeprecated, for removal: This API element is subject to removal in a future version.Usebaggage()and thenWritableBaggage.set(String, String)}.Sets a baggage item in the Span (and its SpanContext) as a key/value pair.- Parameters:
- key- String Key
- value- String Value
- Returns:
- current Span instance
 
- 
baggageDeprecated, for removal: This API element is subject to removal in a future version.Usebaggage()and thenBaggage.get(String).Get Baggage Item by key.- Parameters:
- key- String key
- Returns:
- Optionalof the value of the baggage item
 
- 
baggageWritableBaggage baggage()Returns writable baggage associated with this span.- Returns:
- the mutable baggage instance for the span
 
- 
addEventAdd a new event to this span.- Parameters:
- logMessage- message to log
 
- 
unwrapAccess the underlying span by specific type. This is a dangerous operation that will succeed only if the span is of expected type. This practically removes abstraction capabilities of this API.- Type Parameters:
- T- type of the span
- Parameters:
- spanClass- type to access
- Returns:
- instance of the span
- Throws:
- IllegalArgumentException- in case the span cannot provide the expected type
 
 
- 
baggage()and thenBaggage.get(String).