Class DeferredSpan

  • All Implemented Interfaces:
    Span

    public class DeferredSpan
    extends Object
    implements Span
    Encapsulates concept of a deferred-initialized span. It's used to overcome OpenCensus span implementation, that starts span immediately after deserialization.
    • Constructor Detail

      • DeferredSpan

        public DeferredSpan​(byte[] serializedSpan)
        Constructor.
        Parameters:
        serializedSpan - Serialized span bytes.
    • Method Detail

      • serializedSpan

        public byte[] serializedSpan()
        Returns:
        Serialized span.
      • addTag

        public Span addTag​(String tagName,
                           Supplier<String> tagValSupplier)
        Adds tag to span with String value.
        Specified by:
        addTag in interface Span
        Parameters:
        tagName - Tag name.
        tagValSupplier - Tag value supplier. Supplier is used instead of strict tag value cause of it's lazy nature. So that it's possible not to generate String tag value in case of NoopSpan.
      • addLog

        public Span addLog​(Supplier<String> logDescSupplier)
        Logs work to span.
        Specified by:
        addLog in interface Span
        Parameters:
        logDescSupplier - Log description supplier. Supplier is used instead of strict log description cause of it's lazy nature. So that it's possible not to generate String log description in case of NoopSpan.
      • setStatus

        public Span setStatus​(SpanStatus spanStatus)
        Explicitly set status for span.
        Specified by:
        setStatus in interface Span
        Parameters:
        spanStatus - Status.
      • end

        public Span end()
        Ends span. This action sets default status if not set and mark the span as ready to be exported.
        Specified by:
        end in interface Span
      • isEnded

        public boolean isEnded()
        Specified by:
        isEnded in interface Span
        Returns:
        true if span has already ended.
      • type

        public SpanType type()
        Specified by:
        type in interface Span
        Returns:
        Type of given span.
      • includedScopes

        public Set<Scope> includedScopes()
        Specified by:
        includedScopes in interface Span
        Returns:
        Set of included scopes.
      • isChainable

        public boolean isChainable​(Scope scope)
        Specified by:
        isChainable in interface Span
        Parameters:
        scope - Chainable scope candidate.
        Returns:
        true if given span is chainable with other spans with specified scope.