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:
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
Modifier and TypeInterfaceDescriptionstatic class
Exception indicating that aSpanListener
has invoked an operation that is not permitted. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
Invoked just after a span has been activated.default void
Invoked just after a scope has been closed.default void
Invoked just after a span has been ended successfully.default void
Invoked just after a span has been ended unsuccessfully.default void
Invoked just after a span has been started.default void
starting
(Span.Builder<?> spanBuilder)
-
Method Details
-
starting
- Parameters:
spanBuilder
- theSpan.Builder
for the builder about to be used to start a span- Throws:
SpanListener.ForbiddenOperationException
- if the listener tries to start the span
-
started
Invoked just after a span has been started.- Parameters:
span
-Span
for the newly-started span- Throws:
SpanListener.ForbiddenOperationException
- if the listener tries to end the span
-
activated
Invoked just after a span has been activated.- Parameters:
span
- the just-activatedSpan
scope
- the just-created scope which resulted from activating the span- Throws:
SpanListener.ForbiddenOperationException
- if the listener tries to close the scope or end the span
-
closed
Invoked just after a scope has been closed.- Parameters:
span
-Span
for which a scope was closedscope
- the just-closedScope
- Throws:
SpanListener.ForbiddenOperationException
- if the listener tries to end the span
-
ended
Invoked just after a span has been ended successfully.- Parameters:
span
- the just-endedSpan
-
ended
Invoked just after a span has been ended unsuccessfully.
-