@Immutable public final class BlankSpan extends 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(io.opencensus.trace.Span)
.
Span.Kind, Span.Options
Modifier and Type | Field and Description |
---|---|
static BlankSpan |
INSTANCE
Singleton instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(Annotation annotation)
No-op implementation of the
Span.addAnnotation(Annotation) method. |
void |
addAnnotation(String description,
Map<String,AttributeValue> attributes)
No-op implementation of the
Span.addAnnotation(String, Map) method. |
void |
addLink(Link link)
No-op implementation of the
Span.addLink(Link) method. |
void |
addMessageEvent(MessageEvent messageEvent)
No-op implementation of the
Span.addMessageEvent(MessageEvent) method. |
void |
addNetworkEvent(NetworkEvent networkEvent)
Deprecated.
|
void |
end(EndSpanOptions options)
No-op implementation of the
Span.end(EndSpanOptions) method. |
void |
putAttribute(String key,
AttributeValue value)
No-op implementation of the
Span.putAttribute(String, AttributeValue) method. |
void |
putAttributes(Map<String,AttributeValue> attributes)
No-op implementation of the
Span.putAttributes(Map) method. |
void |
setStatus(Status status)
Sets the
Status to the Span . |
String |
toString() |
addAnnotation, addAttributes, end, getContext, getOptions
public static final BlankSpan INSTANCE
public void putAttribute(String key, AttributeValue value)
Span.putAttribute(String, AttributeValue)
method.putAttribute
in class Span
key
- the key for this attribute.value
- the value for this attribute.public void putAttributes(Map<String,AttributeValue> attributes)
Span.putAttributes(Map)
method.putAttributes
in class Span
attributes
- the attributes that will be added and associated with the Span
.public void addAnnotation(String description, Map<String,AttributeValue> attributes)
Span.addAnnotation(String, Map)
method.addAnnotation
in class Span
description
- the description of the annotation time event.attributes
- the attributes that will be added; these are associated with this annotation,
not the Span
as for Span.putAttributes(Map)
.public void addAnnotation(Annotation annotation)
Span.addAnnotation(Annotation)
method.addAnnotation
in class Span
annotation
- the annotations to add.@Deprecated public void addNetworkEvent(NetworkEvent networkEvent)
Span.addNetworkEvent(NetworkEvent)
method.addNetworkEvent
in class Span
networkEvent
- the network event to add.public void addMessageEvent(MessageEvent messageEvent)
Span.addMessageEvent(MessageEvent)
method.addMessageEvent
in class Span
messageEvent
- the message to add.public void addLink(Link link)
Span.addLink(Link)
method.public void setStatus(Status status)
Span
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. If the status is set via EndSpanOptions.Builder.setStatus(Status)
that
will always be the last call.
public void end(EndSpanOptions options)
Span.end(EndSpanOptions)
method.