Class MicrometerTracingConfigurationEnhancer
- All Implemented Interfaces:
ConfigurationEnhancer
ConfigurationEnhancer that enables Micrometer-Tracing-backed tracing. Discovered automatically via
ServiceLoader, so having the axoniq-tracing-micrometer module on the classpath is enough; there is no need to
register it manually.
It registers a MicrometerSpanFactory as the SpanFactory component and installs the
ProcessingContextAccessor (the reactive bridge that exposes the active Axon span from a
ProcessingContext to Micrometer's context propagation).
Bridge-specific components (host-supplied). This enhancer resolves the Micrometer abstractions as framework
components rather than creating them, because they are provided by a concrete Micrometer tracing bridge (for
example micrometer-tracing-bridge-otel), not by this module:
TracerandPropagator-- required to enable tracing. When either is absent, this enhancer backs off entirely (anINFOlog explains how to enable tracing) and noSpanFactoryis registered -- matching the framework contract that tracing is off when noSpanFactorycomponent exists. The jar being on the classpath (possibly transitively) therefore never breaks a configuration that does not wire a Micrometer bridge.ObservationRegistry-- optional; defaulted toObservationRegistry.create()when absent.
Tracer and Propagator as components, obtained from its chosen
bridge, e.g.:
configurer.componentRegistry(registry -> registry
.registerComponent(Tracer.class, c -> tracer)
.registerComponent(Propagator.class, c -> propagator));
The ContextRegistry is registered as a component (defaulting to ContextRegistry.getInstance()), used
as the source for the ContextSnapshotFactory of the thread-local bridge. The ProcessingContextAccessor
is registered onto that component via a decorator (not onto the global singleton directly), so it honours a
user-registered ContextRegistry. The in-process thread-local bridge itself lives in the threadlocal
sibling package and is installed by a separate, independently toggleable enhancer.
- Since:
- 5.3.0
- Author:
- Mateusz Nowak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidenhance(ComponentRegistry registry) intorder()Returns the relative order this enhancer should be invoked in, compared to other instances.
-
Constructor Details
-
MicrometerTracingConfigurationEnhancer
public MicrometerTracingConfigurationEnhancer()
-
-
Method Details
-
enhance
Description copied from interface:ConfigurationEnhancer- Specified by:
enhancein interfaceConfigurationEnhancer- Parameters:
registry- The registry instance to enhance.
-
order
public int order()Description copied from interface:ConfigurationEnhancerReturns the relative order this enhancer should be invoked in, compared to other instances.Use lower (negative) values for enhancers providing sensible defaults, and higher values for enhancers that should be able to override values potentially previously set. Defaults to
0when not set.- Specified by:
orderin interfaceConfigurationEnhancer- Returns:
- The order in which this enhancer should be invoked.
-