Module brave
Package brave.handler

Class MutableSpan

  • All Implemented Interfaces:
    java.lang.Cloneable

    public final class MutableSpan
    extends java.lang.Object
    implements java.lang.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.

    • Constructor Detail

      • MutableSpan

        public MutableSpan()
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Returns true if there was no data added. Usually this indicates an instrumentation bug.
      • startTimestamp

        public void startTimestamp​(long startTimestamp)
        See Also:
        Span.start(long)
      • finishTimestamp

        public void finishTimestamp​(long finishTimestamp)
        See Also:
        Span.finish(long)
      • localServiceName

        @Nullable
        public java.lang.String localServiceName()
        When null default is used.
      • localIp

        @Nullable
        public java.lang.String localIp()
        When null default will be used for zipkin.
      • localIp

        public boolean localIp​(@Nullable
                               java.lang.String localIp)
        See Also:
        localIp()
      • localPort

        public int localPort()
        When zero default will be used for zipkin.
      • localPort

        public void localPort​(int localPort)
        See Also:
        localPort()
      • 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)
      • 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)
      • tag

        @Nullable
        public java.lang.String tag​(java.lang.String key)
        Returns the last value associated with the key or null
      • 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 is shared 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()