@Immutable public final class BlankSpan extends Object implements Span
BlankSpan is a singleton class, which is the default Span that is used when
no Span implementation is available. All operations are no-op.
Used also to stop tracing, see Tracer.withSpan(openconsensus.trace.Span).
Span.Builder, Span.Kind| Modifier and Type | Field and Description |
|---|---|
static Span |
INSTANCE
Singleton instance of this class.
|
| 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. |
String |
toString() |
void |
updateName(String name)
Updates the
Span name. |
public static final Span INSTANCE
public void setAttribute(String key, String value)
SpanSpan. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.setAttribute in interface Spankey - the key for this attribute.value - the value for this attribute.public void setAttribute(String key, long value)
SpanSpan. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.setAttribute in interface Spankey - the key for this attribute.value - the value for this attribute.public void setAttribute(String key, double value)
SpanSpan. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.setAttribute in interface Spankey - the key for this attribute.value - the value for this attribute.public void setAttribute(String key, boolean value)
SpanSpan. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.setAttribute in interface Spankey - the key for this attribute.value - the value for this attribute.public void setAttribute(String key, AttributeValue value)
SpanSpan. If the Span previously contained a mapping for
the key, the old value is replaced by the specified value.setAttribute in interface Spankey - the key for this attribute.value - the value for this attribute.public void addEvent(String name)
SpanSpan.public void addEvent(String name, Map<String,AttributeValue> attributes)
SpanSpan.public void addEvent(Event event)
SpanSpan.public void addLink(Link link)
SpanLink to the Span.
Used (for example) in batching operations, where a single batch handler processes multiple requests from different traces.
public void updateName(String name)
SpanSpan 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.
updateName in interface Spanname - the Span name.public void end()
SpanSpan 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.
public SpanContext getContext()
SpanSpanContext associated with this Span.getContext in interface SpanSpanContext associated with this Span.public boolean isRecordingEvents()
SpanisRecordingEvents in interface Spantrue if this Span records events.