- java.lang.Object
-
- brave.handler.MutableSpan
-
- All Implemented Interfaces:
java.lang.Cloneable
public final class MutableSpan extends java.lang.Object implements java.lang.CloneableThis represents a span except for itsTraceContext. 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidannotate(long timestamp, java.lang.String value)booleancontainsAnnotation(java.lang.String value)Returns true if an annotation with the given value exists in this span.java.lang.Throwableerror()voiderror(java.lang.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)java.lang.StringlocalIp()When nulldefaultwill be used for zipkin.booleanlocalIp(java.lang.String localIp)intlocalPort()When zerodefaultwill be used for zipkin.voidlocalPort(int localPort)java.lang.StringlocalServiceName()When nulldefaultis used.voidlocalServiceName(java.lang.String localServiceName)java.lang.Stringname()Returns thespan nameor nullvoidname(java.lang.String name)java.lang.StringremoteIp()The text representation of the primary IPv4 or IPv6 address associated with the remote side of this connection.booleanremoteIpAndPort(java.lang.String remoteIp, int remotePort)intremotePort()Port of the remote IP's socket or 0, if not known.java.lang.StringremoteServiceName()voidremoteServiceName(java.lang.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)java.lang.Stringtag(java.lang.String key)Returns the last value associated with the key or nullvoidtag(java.lang.String key, java.lang.String value)
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Returns true if there was no data added. Usually this indicates an instrumentation bug.
-
name
public void name(java.lang.String 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
public void kind(@Nullable Span.Kind kind)
- See Also:
Span.kind(brave.Span.Kind)
-
localServiceName
public void localServiceName(java.lang.String localServiceName)
- See Also:
Tracing.Builder.localServiceName(String)
-
localPort
public int localPort()
When zerodefaultwill be used for zipkin.
-
localPort
public void localPort(int localPort)
- See Also:
localPort()
-
remoteServiceName
@Nullable public java.lang.String remoteServiceName()
- See Also:
Span.remoteServiceName(String)
-
remoteServiceName
public void remoteServiceName(java.lang.String remoteServiceName)
- See Also:
Span.remoteServiceName(String)
-
remoteIp
@Nullable public java.lang.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.- See Also:
InetSocketAddress.getPort(),Span.remoteIpAndPort(String, int)
-
remoteIpAndPort
public boolean remoteIpAndPort(@Nullable java.lang.String remoteIp, int remotePort)
- See Also:
Span.remoteIpAndPort(String, int)
-
containsAnnotation
public boolean containsAnnotation(java.lang.String value)
Returns true if an annotation with the given value exists in this span.
-
annotate
public void annotate(long timestamp, java.lang.String value)- See Also:
Span.annotate(String)
-
error
public java.lang.Throwable error()
- See Also:
Span.error(Throwable)
-
error
public void error(java.lang.Throwable error)
- See Also:
Span.error(Throwable)
-
tag
@Nullable public java.lang.String tag(java.lang.String key)
Returns the last value associated with the key or null
-
tag
public void tag(java.lang.String key, java.lang.String value)- See Also:
Span.tag(String, String)
-
forEachTag
public <T> void forEachTag(MutableSpan.TagConsumer<T> tagConsumer, T target)
-
forEachTag
public void forEachTag(MutableSpan.TagUpdater tagUpdater)
Allows you to update values for redaction purposes
-
forEachAnnotation
public <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.
-
forEachAnnotation
public void forEachAnnotation(MutableSpan.AnnotationUpdater annotationUpdater)
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()
-
-