Interface AssertingSpan

  • All Superinterfaces:
    Span, SpanCustomizer

    public interface AssertingSpan
    extends Span
    Span that performs additional assertions such as allowed name, tag, event verification and upon reporting, whether the span had been started in the first place. You need to turn on assertions via system properties or environment variables to start breaking your tests or production code. Check DocumentedSpanAssertions for more information.
    Since:
    3.1.0
    Author:
    Marcin Grzejszczak
    • Method Detail

      • getDelegate

        Span getDelegate()
        Returns:
        wrapped Span
      • isStarted

        default boolean isStarted()
        Returns:
        true when this span was started
      • tag

        default AssertingSpan tag​(String key,
                                  String value)
        Description copied from interface: Span
        Sets a tag on this span.
        Specified by:
        tag in interface Span
        Specified by:
        tag in interface SpanCustomizer
        Parameters:
        key - tag key
        value - tag value
        Returns:
        this span
      • tag

        default AssertingSpan tag​(TagKey key,
                                  String value)
        Tags a span via TagKey.
        Parameters:
        key - tag key
        value - tag value
        Returns:
        this for chaining
      • event

        default AssertingSpan event​(String value)
        Description copied from interface: Span
        Sets an event on this span.
        Specified by:
        event in interface Span
        Specified by:
        event in interface SpanCustomizer
        Parameters:
        value - event name to set on the span
        Returns:
        this span
      • name

        default AssertingSpan name​(String name)
        Description copied from interface: Span
        Sets a name on this span.
        Specified by:
        name in interface Span
        Specified by:
        name in interface SpanCustomizer
        Parameters:
        name - name to set on the span
        Returns:
        this span
      • isNoop

        default boolean isNoop()
        Specified by:
        isNoop in interface Span
        Returns:
        true when no recording is done and nothing is reported to an external system. However, this span should still be injected into outgoing requests. Use this flag to avoid performing expensive computation.
      • start

        default AssertingSpan start()
        Description copied from interface: Span
        Starts this span.
        Specified by:
        start in interface Span
        Returns:
        this span
      • error

        default AssertingSpan error​(Throwable throwable)
        Description copied from interface: Span
        Records an exception for this span.
        Specified by:
        error in interface Span
        Parameters:
        throwable - to record
        Returns:
        this span
      • end

        default void end()
        Description copied from interface: Span
        Ends the span. The span gets stopped and recorded if not noop.
        Specified by:
        end in interface Span
      • abandon

        default void abandon()
        Description copied from interface: Span
        Ends the span. The span gets stopped but does not get recorded.
        Specified by:
        abandon in interface Span
      • remoteServiceName

        default AssertingSpan remoteServiceName​(String remoteServiceName)
        Description copied from interface: Span
        Sets the remote service name for the span.
        Specified by:
        remoteServiceName in interface Span
        Parameters:
        remoteServiceName - remote service name
        Returns:
        this span
      • remoteIpAndPort

        default Span remoteIpAndPort​(String ip,
                                     int port)
        Description copied from interface: Span
        Sets the remote url on the span.
        Specified by:
        remoteIpAndPort in interface Span
        Parameters:
        ip - remote ip
        port - remote port
        Returns:
        this span
      • of

        static AssertingSpan of​(DocumentedSpan documentedSpan,
                                Span span)
        Parameters:
        documentedSpan - span configuration
        span - span to wrap in assertions
        Returns:
        asserting span
      • continueSpan

        static AssertingSpan continueSpan​(DocumentedSpan documentedSpan,
                                          Span span)
        Parameters:
        documentedSpan - span configuration
        span - span to wrap in assertions
        Returns:
        asserting span
      • unwrap

        static <T extends Span> T unwrap​(Span span)
        Returns the underlying delegate. Used when casting is necessary.
        Type Parameters:
        T - type extending a span
        Parameters:
        span - span to check for wrapping
        Returns:
        unwrapped object