Package brave.handler
Class MutableSpan
java.lang.Object
brave.handler.MutableSpan
- All Implemented Interfaces:
Cloneable
public final class MutableSpan extends Object implements Cloneable
This represents a span except for its
TraceContext
. It is mutable, for late adjustments.
While in-flight, the data is synchronized where necessary. When exposed to users, it can be mutated without synchronization.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MutableSpan.AnnotationConsumer<T>
static interface
MutableSpan.AnnotationUpdater
static interface
MutableSpan.TagConsumer<T>
static interface
MutableSpan.TagUpdater
-
Constructor Summary
Constructors Constructor Description MutableSpan()
-
Method Summary
Modifier and Type Method Description void
annotate(long timestamp, String value)
boolean
containsAnnotation(String value)
Returns true if an annotation with the given value exists in this span.Throwable
error()
void
error(Throwable error)
long
finishTimestamp()
Returns thespan finish timestamp
or zerovoid
finishTimestamp(long finishTimestamp)
<T> void
forEachAnnotation(MutableSpan.AnnotationConsumer<T> annotationConsumer, T target)
Allows you to copy all data into a different target, such as a different span model or logs.void
forEachAnnotation(MutableSpan.AnnotationUpdater annotationUpdater)
Allows you to update values for redaction purposes<T> void
forEachTag(MutableSpan.TagConsumer<T> tagConsumer, T target)
void
forEachTag(MutableSpan.TagUpdater tagUpdater)
Allows you to update values for redaction purposesboolean
isEmpty()
Returns true if there was no data added.Span.Kind
kind()
Returns thespan kind
or nullvoid
kind(Span.Kind kind)
String
localIp()
When nulldefault
will be used for zipkin.boolean
localIp(String localIp)
int
localPort()
When zerodefault
will be used for zipkin.void
localPort(int localPort)
String
localServiceName()
When nulldefault
is used.void
localServiceName(String localServiceName)
String
name()
Returns thespan name
or nullvoid
name(String name)
String
remoteIp()
The text representation of the primary IPv4 or IPv6 address associated with the remote side of this connection.boolean
remoteIpAndPort(String remoteIp, int remotePort)
int
remotePort()
Port of the remote IP's socket or 0, if not known.String
remoteServiceName()
void
remoteServiceName(String remoteServiceName)
void
setShared()
Indicates we are contributing to a span started by another tracer (ex on a different host).boolean
shared()
Returns true if the span ID isshared
with a remote client.long
startTimestamp()
Returns thespan start timestamp
or zerovoid
startTimestamp(long startTimestamp)
String
tag(String key)
Returns the last value associated with the key or nullvoid
tag(String key, String value)
-
Constructor Details
-
MutableSpan
public MutableSpan()
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returns true if there was no data added. Usually this indicates an instrumentation bug. -
name
Returns thespan name
or null -
name
- See Also:
Span.name(String)
-
startTimestamp
public long startTimestamp()Returns thespan start timestamp
or zero -
startTimestamp
public void startTimestamp(long startTimestamp)- See Also:
Span.start(long)
-
finishTimestamp
public long finishTimestamp()Returns thespan finish timestamp
or zero -
finishTimestamp
public void finishTimestamp(long finishTimestamp)- See Also:
Span.finish(long)
-
kind
Returns thespan kind
or null -
kind
- See Also:
Span.kind(brave.Span.Kind)
-
localServiceName
When nulldefault
is used. -
localServiceName
- See Also:
Tracing.Builder.localServiceName(String)
-
localIp
When nulldefault
will be used for zipkin. -
localIp
- See Also:
localIp()
-
localPort
public int localPort()When zerodefault
will be used for zipkin. -
localPort
public void localPort(int localPort)- See Also:
localPort()
-
remoteServiceName
- See Also:
Span.remoteServiceName(String)
-
remoteServiceName
- See Also:
Span.remoteServiceName(String)
-
remoteIp
The text representation of the primary IPv4 or IPv6 address associated with the remote side of this connection. Ex. 192.168.99.100 null if unknown.- See Also:
Span.remoteIpAndPort(String, int)
-
remotePort
public int remotePort()Port of the remote IP's socket or 0, if not known. -
remoteIpAndPort
- See Also:
Span.remoteIpAndPort(String, int)
-
containsAnnotation
Returns true if an annotation with the given value exists in this span. -
annotate
- See Also:
Span.annotate(String)
-
error
- See Also:
Span.error(Throwable)
-
error
- See Also:
Span.error(Throwable)
-
tag
Returns the last value associated with the key or null -
tag
- See Also:
Span.tag(String, String)
-
forEachTag
-
forEachTag
Allows you to update values for redaction purposes -
forEachAnnotation
Allows you to copy all data into a different target, such as a different span model or logs. -
forEachAnnotation
Allows you to update values for redaction purposes -
shared
public boolean shared()Returns true if the span ID isshared
with a remote client. -
setShared
public void setShared()Indicates we are contributing to a span started by another tracer (ex on a different host). Defaults to false.- See Also:
Tracer.joinSpan(TraceContext)
,Span.shared()
-