public interface Span
The Span
is an abstraction for Axon Framework to have tracing capabilities without knowing the specific
tracing provider. Calling start()
will start the span
and make it active to the current thread. For
every start invocation, a respective end()
should be called as well to prevent scope leaks.
Creating spans
is the responsibility of the SpanFactory
which should be implemented by the
tracing provider of choice.
For more information about creating different kinds of traces.
Modifier and Type | Method and Description |
---|---|
void |
end()
Ends the span.
|
Span |
recordException(Throwable t)
Records an exception to the span.
|
default void |
run(Runnable runnable)
Runs a piece of code which will be traced.
|
default <T> T |
runCallable(Callable<T> callable)
Runs a piece of code which will be traced.
|
default <T> T |
runSupplier(Supplier<T> supplier)
Runs a piece of code that returns a value and which will be traced.
|
Span |
start()
Starts the Span.
|
default <T> Callable<T> |
wrapCallable(Callable<T> callable)
|
default Runnable |
wrapRunnable(Runnable runnable)
|
default <T> Supplier<T> |
wrapSupplier(Supplier<T> supplier)
Wraps a
Supplier , tracing the invocation. |
Span start()
void end()
Span recordException(Throwable t)
t
- The exception to recorddefault void run(Runnable runnable)
Runnable
will be invoked instantly and synchronously.runnable
- The Runnable
to execute.default Runnable wrapRunnable(Runnable runnable)
Runnable
, propagating the current span context to the actual thread that runs the
Runnable
. If you don't wrap a runnable before passing it to an Executor
the
context will be lost and a new trace will be started.runnable
- The Runnable
to wrapdefault <T> T runCallable(Callable<T> callable) throws Exception
Callable
will be invoked instantly and synchronously.default <T> Callable<T> wrapCallable(Callable<T> callable)
Callable
, propagating the current span context to the actual thread that runs the
Callable
. If you don't wrap a callable before passing it to an Executor
the
context will be lost and a new trace will be started.callable
- The Callable
to wrapdefault <T> T runSupplier(Supplier<T> supplier)
Supplier
will be invoked instantly and synchronously.supplier
- The Supplier
to execute.default <T> Supplier<T> wrapSupplier(Supplier<T> supplier)
Supplier
, tracing the invocation. Exceptions will be caught automatically and added to the span,
then rethrown. The span will be started before the execution, and ended after execution.supplier
- The Supplier
to wrapCopyright © 2010–2023. All rights reserved.