OpenTracing deprecation warningThe OpenTracing extension works in a different way than described on this page. Its functionality is limited and will not be updated to include the additional functionality described on this page. The OpenTracing standard itself is deprecated, please consider moving to OpenTelemetry instead.
SpanFactory. This factory is responsible for the creation of multiple instances of a
Spanwith a specific purpose.
SpanFactoryprovided the framework that matches your tracing standard. Or, if your tracing standard of choice is not supported, you can create one yourself by implementing the
Spaninterfaces. The following standards are currently supported:
SpanFactoryin the following ways:
AccountRegisteredEventis published and a deadline is scheduled as well. In this image, the
AutomaticAccountCommandDispatcher.dispatchspan is the root trace, with each span being part of a call hierarchy within that trace.
SpanFactoryimplementations, while Axon's configuration only allows one. For this purpose, the framework contains the
MultiSpanFactorythat you can configure with multiple factories to which it delegates its calls.
OpenTelemetrySpanFactoryin the following fashion:
MultiSpanFactorya single, delegating span is created whenever the framework requests it. This span contains the multiple span, one of each configured factory. The deleting span makes sure all spans are called, acting as a single one.
SpanFactoryis responsible for creating spans when the framework requests it. The framework specifies the type of span, the name, and a message that triggered the span (if any, it's not required). The framework can request the span types defined in the following table:
SpanAttributesProvider, which can be registered to the
SpanFactoryeither via its builder (if supported) or by calling the
SpanAttributesProviderimplementations are included in Axon Framework:
SpanAttributesProvider. and add it to the
SpanFactory. Use this if you want to add custom information on spans as a label.
SpanAttributesProviderin one of the following ways.
axon-tracing-opentelemetrymodule, this trace will be propagated to all subsequent Axon Framework messages. For example, if the REST call produces a command which is sent over Axon Server, handling the command will be included in the same trace as the original REST call.
Configurerof Axon Framework to configure the
LoggingSpanFactoryin the following ways:
SpanFactory. The spans created by each component are available for reference in this section, with additional information about how they should be interpreted.
CommandBusimplementation which does not call the
CommandBusis instrumented to create spans for both dispatching and handling commands. The tracing differs based on whether you are using Axon Server. The following tabs show the possible traces.
AxonServerCommandBus, there will be two handling and dispatch traces since it uses a second
CommandBusto invoke the command locally after receiving it from Axon Server. In addition, you can see the GRPC-call to Axon Server and the time it took to handle the call.
Snapshotterinvocation will be linked to the command handling span after which the snapshot was scheduled to be created.
Snapshottercalls of the same aggregate type together.
AbstractSagaManagerhas been instructed with additional tracing information. These spans are descendants of an event processor span that invokes the manager.
ResponseProcessingTaskspan since their results are directly published to the invoker of the query. Traces will differ based on whether Axon Server is used or not. The following tabs show the possible traces.
SimpleQueryUpdateEmitterwill be linked to the span of the queries that are listening to it, so the original call can easily be found.
QueryUpdateEmittertraces will look like the following table:
TracingHandlerEnhancerDefinitionautomatically creates a span for each message handler invocation within your application. This is true for commands, events, queries and even custom message handlers. Spans will be created with the following format:
ContainingClassName.methodName(ArgumentClass1, Argumentclass2, etc). Examples of this are:
TracingHandlerEnhancerDefinitionfunctionality is autoconfigured for Spring Boot, with event sourcing handlers turned off by default. This is because loading an aggregate might invoke many of these handlers, hitting the maximum number of spans for your APM tool. Please refer to the Spring Boot configuration section if you want to enable this.