Interface SpanListener


public interface SpanListener
A listener notified of span lifecycle events.

All methods are default no-op methods, allowing concrete implementations to implement only the methods that are relevant for them.

Helidon invokes the applicable methods of a listener in the following order:

Order of Invocation of Listener Methods
Method When invoked
starting Before a span is started from its builder.
started After a span has started.
activated After a span has been activated, creating a new scope in the process.
closed After a scope has been closed.
ended (successful) * After a span has ended successfully.
ended (unsuccessful) * After a span has ended unsuccessfully.
† Not all spans are activated; it is up to the application or library code that creates and manages the span. As a result Helidon might not invoke your listener's activated and closed methods for every span.

* The successful or unsuccessful nature of a span's end is not about whether the tracing or telemetry system failed to end the span. Rather, it indicates whether the code that ended the span indicated some error in the processing which the span represents.

When Helidon invokes the listener methods it passes implementations of the key span types (Span.Builder, Span, Scope) which do not support lifecycle state changes. If a listener tries to start or end or activate a span, for example, Helidon throws an SpanListener.ForbiddenOperationException.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Exception indicating that a SpanListener has invoked an operation that is not permitted.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    activated(Span span, Scope scope)
    Invoked just after a span has been activated.
    default void
    closed(Span span, Scope scope)
    Invoked just after a scope has been closed.
    default void
    ended(Span span)
    Invoked just after a span has been ended successfully.
    default void
    ended(Span span, Throwable t)
    Invoked just after a span has been ended unsuccessfully.
    default void
    started(Span span)
    Invoked just after a span has been started.
    default void
    starting(Span.Builder<?> spanBuilder)
    Invoked just prior to a span being started from its builder.
  • Method Details