Class DelegatingSpanData

  • All Implemented Interfaces:
    SpanData

    public abstract class DelegatingSpanData
    extends java.lang.Object
    implements SpanData
    A SpanData which delegates all methods to another SpanData. Extend this class to modify the SpanData that will be exported, for example by creating a delegating SpanExporter which wraps SpanData with a custom implementation.
    
     // class SpanDataWithClientType extends DelegatingSpanData {
     //
     //   private final Attributes attributes;
     //
     //   SpanDataWithClientType(SpanData delegate) {
     //     super(delegate);
     //     String clientType = ClientConfig.parseUserAgent(
     //       delegate.getAttributes().get(SemanticAttributes.USER_AGENT_ORIGINAL).getStringValue());
     //     Attributes.Builder newAttributes = Attributes.builder(delegate.getAttributes());
     //     newAttributes.setAttribute("client_type", clientType);
     //     attributes = newAttributes.build();
     //   }
     //
     //   @Override
     //   public Attributes getAttributes() {
     //     return attributes;
     //   }
     // }
     
    • Field Detail

      • delegate

        private final SpanData delegate
    • Constructor Detail

      • DelegatingSpanData

        protected DelegatingSpanData​(SpanData delegate)
    • Method Detail

      • 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.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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