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 interfaceMutableSpan.AnnotationConsumer<T>static interfaceMutableSpan.AnnotationUpdaterstatic interfaceMutableSpan.TagConsumer<T>static interfaceMutableSpan.TagUpdater -
Constructor Summary
Constructors Constructor Description MutableSpan() -
Method Summary
Modifier and Type Method Description voidannotate(long timestamp, String value)booleancontainsAnnotation(String value)Returns true if an annotation with the given value exists in this span.Throwableerror()voiderror(Throwable error)longfinishTimestamp()Returns thespan finish timestampor zerovoidfinishTimestamp(long finishTimestamp)<T> voidforEachAnnotation(MutableSpan.AnnotationConsumer<T> annotationConsumer, T target)Allows you to copy all data into a different target, such as a different span model or logs.voidforEachAnnotation(MutableSpan.AnnotationUpdater annotationUpdater)Allows you to update values for redaction purposes<T> voidforEachTag(MutableSpan.TagConsumer<T> tagConsumer, T target)voidforEachTag(MutableSpan.TagUpdater tagUpdater)Allows you to update values for redaction purposesbooleanisEmpty()Returns true if there was no data added.Span.Kindkind()Returns thespan kindor nullvoidkind(Span.Kind kind)StringlocalIp()When nulldefaultwill be used for zipkin.booleanlocalIp(String localIp)intlocalPort()When zerodefaultwill be used for zipkin.voidlocalPort(int localPort)StringlocalServiceName()When nulldefaultis used.voidlocalServiceName(String localServiceName)Stringname()Returns thespan nameor nullvoidname(String name)StringremoteIp()The text representation of the primary IPv4 or IPv6 address associated with the remote side of this connection.booleanremoteIpAndPort(String remoteIp, int remotePort)intremotePort()Port of the remote IP's socket or 0, if not known.StringremoteServiceName()voidremoteServiceName(String remoteServiceName)voidsetShared()Indicates we are contributing to a span started by another tracer (ex on a different host).booleanshared()Returns true if the span ID issharedwith a remote client.longstartTimestamp()Returns thespan start timestampor zerovoidstartTimestamp(long startTimestamp)Stringtag(String key)Returns the last value associated with the key or nullvoidtag(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 nameor null -
name
- See Also:
Span.name(String)
-
startTimestamp
public long startTimestamp()Returns thespan start timestampor zero -
startTimestamp
public void startTimestamp(long startTimestamp)- See Also:
Span.start(long)
-
finishTimestamp
public long finishTimestamp()Returns thespan finish timestampor zero -
finishTimestamp
public void finishTimestamp(long finishTimestamp)- See Also:
Span.finish(long)
-
kind
Returns thespan kindor null -
kind
- See Also:
Span.kind(brave.Span.Kind)
-
localServiceName
When nulldefaultis used. -
localServiceName
- See Also:
Tracing.Builder.localServiceName(String)
-
localIp
When nulldefaultwill be used for zipkin. -
localIp
- See Also:
localIp()
-
localPort
public int localPort()When zerodefaultwill 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 issharedwith 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()
-