Class SpanWrapper

  • All Implemented Interfaces:
    SpanData
    Direct Known Subclasses:
    AutoValue_SpanWrapper

    @Immutable
    abstract class SpanWrapper
    extends java.lang.Object
    implements SpanData
    Immutable class that stores SpanData based on a SdkSpan.

    This class stores a reference to a mutable SdkSpan (delegate) which it uses only the immutable parts from, and a copy of all the mutable parts.

    When adding a new field to SdkSpan, store a copy if and only if the field is mutable in the SdkSpan. Otherwise retrieve it from the referenced SdkSpan.

    • Constructor Detail

      • SpanWrapper

        SpanWrapper()
    • Method Detail

      • delegate

        abstract SdkSpan delegate()
      • resolvedLinks

        abstract java.util.List<LinkData> resolvedLinks()
      • resolvedEvents

        abstract java.util.List<EventData> resolvedEvents()
      • totalAttributeCount

        abstract int totalAttributeCount()
      • totalRecordedEvents

        abstract int totalRecordedEvents()
      • totalRecordedLinks

        abstract int totalRecordedLinks()
      • name

        abstract java.lang.String name()
      • endEpochNanos

        abstract long endEpochNanos()
      • internalHasEnded

        abstract boolean internalHasEnded()
      • create

        static SpanWrapper create​(SdkSpan delegate,
                                  java.util.List<LinkData> links,
                                  java.util.List<EventData> events,
                                  Attributes attributes,
                                  int totalAttributeCount,
                                  int totalRecordedEvents,
                                  int totalRecordedLinks,
                                  StatusData status,
                                  java.lang.String name,
                                  long endEpochNanos,
                                  boolean hasEnded)
        Note: the collections that are passed into this creator method are assumed to be immutable to preserve the overall immutability of the class.
      • getResource

        public Resource getResource()
        Description copied from interface: SpanData
        Returns the resource of this Span.
        Specified by:
        getResource in interface SpanData
        Returns:
        the resource of this Span.
      • getName

        public java.lang.String getName()
        Description copied from interface: SpanData
        Returns the name of this Span.
        Specified by:
        getName in interface SpanData
        Returns:
        the name of this Span.
      • getKind

        public SpanKind getKind()
        Description copied from interface: SpanData
        Returns the kind of this Span.
        Specified by:
        getKind in interface SpanData
        Returns:
        the kind of this Span.
      • getStartEpochNanos

        public long getStartEpochNanos()
        Description copied from interface: SpanData
        Returns the start epoch timestamp in nanos of this Span.
        Specified by:
        getStartEpochNanos in interface SpanData
        Returns:
        the start epoch timestamp in nanos of this Span.
      • getAttributes

        public Attributes getAttributes()
        Description copied from interface: SpanData
        Returns the attributes recorded for this Span.
        Specified by:
        getAttributes in interface SpanData
        Returns:
        the attributes recorded for this Span.
      • getEvents

        public java.util.List<EventData> getEvents()
        Description copied from interface: SpanData
        Returns the timed events recorded for this Span.
        Specified by:
        getEvents in interface SpanData
        Returns:
        the timed events recorded for this Span.
      • getLinks

        public java.util.List<LinkData> getLinks()
        Description copied from interface: SpanData
        Returns links recorded for this Span.
        Specified by:
        getLinks in interface SpanData
        Returns:
        links recorded for this Span.
      • getStatus

        public StatusData getStatus()
        Description copied from interface: SpanData
        Returns the Status.
        Specified by:
        getStatus in interface SpanData
        Returns:
        the Status.
      • getEndEpochNanos

        public long getEndEpochNanos()
        Description copied from interface: SpanData
        Returns the end epoch timestamp in nanos of this Span.
        Specified by:
        getEndEpochNanos in interface SpanData
        Returns:
        the end epoch timestamp in nanos of this Span.
      • hasEnded

        public boolean hasEnded()
        Description copied from interface: SpanData
        Returns whether this Span has already been ended.
        Specified by:
        hasEnded in interface SpanData
        Returns:
        true if the span has already been ended, false if not.
      • getTotalRecordedEvents

        public int getTotalRecordedEvents()
        Description copied from interface: SpanData
        The total number of EventData events that were recorded on this span. This number may be larger than the number of events that are attached to this span, if the total number recorded was greater than the configured maximum value. See: SpanLimits.getMaxNumberOfEvents()
        Specified by:
        getTotalRecordedEvents in interface SpanData
        Returns:
        The total number of events recorded on this span.
      • getTotalRecordedLinks

        public int getTotalRecordedLinks()
        Description copied from interface: SpanData
        The total number of LinkData links that were recorded on this span. This number may be larger than the number of links that are attached to this span, if the total number recorded was greater than the configured maximum value. See: SpanLimits.getMaxNumberOfLinks()
        Specified by:
        getTotalRecordedLinks in interface SpanData
        Returns:
        The total number of links recorded on this span.
      • getTotalAttributeCount

        public int getTotalAttributeCount()
        Description copied from interface: SpanData
        The total number of attributes that were recorded on this span. This number may be larger than the number of attributes that are attached to this span, if the total number recorded was greater than the configured maximum value. See: SpanLimits.getMaxNumberOfAttributes()
        Specified by:
        getTotalAttributeCount in interface SpanData
        Returns:
        The total number of attributes on this span.
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object