public interface Span
SpanContext.
Spans are created by the Span.Builder.startSpan() method.
Span must be ended by calling end().
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Span.Builder
Span.Builder is used to construct Span instances which define arbitrary scopes of
code that are sampled for distributed tracing as a single atomic unit. |
static class |
Span.Kind
Type of span.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEvent(Event event)
Adds an event to the
Span. |
void |
addEvent(String name)
Adds an event to the
Span. |
void |
addEvent(String name,
Map<String,AttributeValue> attributes)
Adds an event to the
Span. |
void |
addLink(Link link)
Adds a
Link to the Span. |
void |
end()
Marks the end of
Span execution with the default options. |
SpanContext |
getContext()
Returns the
SpanContext associated with this Span. |
boolean |
isRecordingEvents()
|
void |
setAttribute(String key,
AttributeValue value)
Sets an attribute to the
Span. |
void |
setAttribute(String key,
boolean value)
Sets an attribute to the
Span. |
void |
setAttribute(String key,
double value)
Sets an attribute to the
Span. |
void |
setAttribute(String key,
long value)
Sets an attribute to the
Span. |
void |
setAttribute(String key,
String value)
Sets an attribute to the
Span. |
void |
setStatus(Status status)
Sets the
Status to the Span. |
void |
updateName(String name)
Updates the
Span name. |
void setAttribute(String key, String value)
Span. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.key - the key for this attribute.value - the value for this attribute.void setAttribute(String key, long value)
Span. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.key - the key for this attribute.value - the value for this attribute.void setAttribute(String key, double value)
Span. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.key - the key for this attribute.value - the value for this attribute.void setAttribute(String key, boolean value)
Span. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.key - the key for this attribute.value - the value for this attribute.void setAttribute(String key, AttributeValue value)
Span. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.key - the key for this attribute.value - the value for this attribute.void addEvent(String name)
Span.name - the name of the event.void addEvent(String name, Map<String,AttributeValue> attributes)
Span.name - the name of the event.attributes - the attributes that will be added; these are associated with this event, not
the Span as for setAttributes().void addEvent(Event event)
Span.event - the event to add.void addLink(Link link)
Link to the Span.
Used (for example) in batching operations, where a single batch handler processes multiple requests from different traces.
link - the link to add.void setStatus(Status status)
Status to the Span.
If used, this will override the default Span status. Default is Status.OK.
Only the value of the last call will be recorded, and implementations are free to ignore previous calls.
status - the Status to set.void updateName(String name)
Span name.
If used, this will override the name provided via Span.Builder.
Upon this update, any sampling behavior based on Span name will depend on the
implementation.
name - the Span name.void end()
Span execution with the default options.
Only the timing of the first end call for a given Span will be recorded, and
implementations are free to ignore all further calls.
SpanContext getContext()
SpanContext associated with this Span.SpanContext associated with this Span.boolean isRecordingEvents()
true if this Span records events.