CommandBus
,
EventProcessor
and QueryBus
. Use the distributedInSameTrace
of these instead.@Deprecated public class NestingSpanFactory extends Object implements SpanFactory
SpanFactory
that wraps another factory and creates nested spans when handling messages
instead of starting a new trace. This is true for all messages, such as events, commands, deadlines and queries.
For events and deadlines specifically, this factory includes a time limit (by default 2 minutes, but is configurable on the builder). After that time limit, handling these message types will become a separate trace. The time limit prevents handling of events from being added to the original trace after a longer period of time, such as when replaying an event processor.
Modifier and Type | Class and Description |
---|---|
static class |
NestingSpanFactory.Builder
Deprecated.
Creates a builder that will create a
NestingSpanFactory . |
Modifier | Constructor and Description |
---|---|
protected |
NestingSpanFactory(NestingSpanFactory.Builder builder)
Deprecated.
Creates the
NestingSpanFactory based on the NestingSpanFactory.Builder provided. |
Modifier and Type | Method and Description |
---|---|
static NestingSpanFactory.Builder |
builder()
Deprecated.
Creates a new
NestingSpanFactory.Builder that can build a NestingSpanFactory . |
Span |
createDispatchSpan(Supplier<String> operationNameSupplier,
Message<?> parentMessage,
Message<?>... linkedSiblings)
Deprecated.
|
Span |
createHandlerSpan(Supplier<String> operationNameSupplier,
Message<?> parentMessage,
boolean isChildTrace,
Message<?>... linkedParents)
Deprecated.
|
Span |
createInternalSpan(Supplier<String> operationNameSupplier)
Deprecated.
Creates a new
Span linked to the currently active span. |
Span |
createInternalSpan(Supplier<String> operationNameSupplier,
Message<?> message)
Deprecated.
Creates a new
Span linked to the currently active span. |
Span |
createRootTrace(Supplier<String> operationNameSupplier)
Deprecated.
Creates a new
Span without any parent trace. |
<M extends Message<?>> |
propagateContext(M message)
Deprecated.
Propagates the currently active trace and span to the message.
|
void |
registerSpanAttributeProvider(SpanAttributesProvider provider)
Deprecated.
Registers an additional
SpanAttributesProvider to the factory. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createChildHandlerSpan, createLinkedHandlerSpan
protected NestingSpanFactory(NestingSpanFactory.Builder builder)
NestingSpanFactory
based on the NestingSpanFactory.Builder
provided.builder
- The NestingSpanFactory.Builder
to use during construction.public static NestingSpanFactory.Builder builder()
NestingSpanFactory.Builder
that can build a NestingSpanFactory
.
Requires the delegate SpanFactory
to be configured.
The Clock
defaults to the system utc time and the timeLimit Duration
defaults to two minutes.
NestingSpanFactory.Builder
in charge of creating a NestingSpanFactory
.public Span createRootTrace(Supplier<String> operationNameSupplier)
SpanFactory
Span
without any parent trace. This should be used for logical start point of asynchronous
calls that are not related to a message. For example snapshotting an aggregate.
In monitoring systems, this Span will be the root of the trace.
createRootTrace
in interface SpanFactory
operationNameSupplier
- Supplier of the operation's name.Span
.public Span createHandlerSpan(Supplier<String> operationNameSupplier, Message<?> parentMessage, boolean isChildTrace, Message<?>... linkedParents)
SpanFactory
Span
linked to asynchronously handling a Message
, for example when handling a
command from Axon Server. The message attributes will be added to the span, based on the provided
SpanAttributesProviders
for additional debug information.
In monitoring systems, this Span will be the root of the trace.
The message's name will be concatenated with the operationName
, see
SpanUtils.determineMessageName(Message)
.
createHandlerSpan
in interface SpanFactory
operationNameSupplier
- Supplier of the operation's name.parentMessage
- The message that is being handled.isChildTrace
- Whether to force the span to be a part of the current trace. This means not linking, but
setting a parent.linkedParents
- Optional parameter, providing this will link the provided message(s) to the current, in
addition to the original.Span
.public Span createDispatchSpan(Supplier<String> operationNameSupplier, Message<?> parentMessage, Message<?>... linkedSiblings)
SpanFactory
Span
linked to dispatching a Message
, for example when sending a command to Axon
Server. The message attributes will be added to the span, based on the provided
SpanAttributesProviders
for additional debug information.
In monitoring systems, this Span will be part of another trace.
Before asynchronously dispatching a message, add the tracing context to the message, using
SpanFactory.propagateContext(Message)
to the message's metadata.
The message's name will be concatenated with the operationName
, see
SpanUtils.determineMessageName(Message)
.
createDispatchSpan
in interface SpanFactory
operationNameSupplier
- Supplier of the operation's name.parentMessage
- The message that is being handled.linkedSiblings
- Optional parameter, providing this will link the provided messages to the current.Span
.public Span createInternalSpan(Supplier<String> operationNameSupplier)
SpanFactory
Span
linked to the currently active span. This is useful for tracing different parts of
framework logic, so we can time what has the most impact.
In monitoring systems, this Span will be part of another trace.
createInternalSpan
in interface SpanFactory
operationNameSupplier
- Supplier of the operation's name.Span
.public Span createInternalSpan(Supplier<String> operationNameSupplier, Message<?> message)
SpanFactory
Span
linked to the currently active span. This is useful for tracing different parts of
framework logic, so we can time what has the most impact.
The message supplied is used to provide a clearer name, based on SpanUtils.determineMessageName(Message)
,
and to add the message's attributes to the span.
In monitoring systems, this Span will be part of another trace.
createInternalSpan
in interface SpanFactory
operationNameSupplier
- Supplier of the operation's name.Span
.public void registerSpanAttributeProvider(SpanAttributesProvider provider)
SpanFactory
SpanAttributesProvider
to the factory.registerSpanAttributeProvider
in interface SpanFactory
provider
- The provider to add.public <M extends Message<?>> M propagateContext(M message)
SpanFactory
SpanFactory.createLinkedHandlerSpan(Supplier, Message, Message[])
method. The most efficient method
currently known is to enhance the message's metadata.
Since messages are immutable, the method returns the enhanced message. This enhanced message should be used during dispatch instead of the original message.
propagateContext
in interface SpanFactory
M
- The message's type.message
- The message to enhance.Copyright © 2010–2024. All rights reserved.