Interface Span

  • All Known Implementing Classes:
    DeferredSpan, NoopSpan, SpanImpl

    public interface Span
    Logical piece of a trace that represents a single operation. Each unit work is called a Span in a trace. Spans include metadata about the work, including the time spent in the step (latency), status, time events, attributes, links. You can use tracing to debug errors and latency issues in your applications.
    • Method Detail

      • addTag

        Span addTag​(String tagName,
                    Supplier<String> tagValSupplier)
        Adds tag to span with String value.
        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

        Span addLog​(Supplier<String> logDescSupplier)
        Logs work to 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

        Span setStatus​(SpanStatus spanStatus)
        Explicitly set status for span.
        Parameters:
        spanStatus - Status.
      • end

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

        boolean isEnded()
        Returns:
        true if span has already ended.
      • type

        SpanType type()
        Returns:
        Type of given span.
      • includedScopes

        Set<Scope> includedScopes()
        Returns:
        Set of included scopes.
      • isChainable

        default boolean isChainable​(Scope scope)
        Parameters:
        scope - Chainable scope candidate.
        Returns:
        true if given span is chainable with other spans with specified scope.