Class NoopSpan

  • All Implemented Interfaces:
    Span

    public class NoopSpan
    extends Object
    implements Span
    Noop and null-safe implementation of Span.
    • Field Detail

      • INSTANCE

        public static final Span INSTANCE
        Instance.
    • Method Detail

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