Class MicrometerTracingAutoConfiguration

java.lang.Object
io.axoniq.framework.springboot.autoconfig.MicrometerTracingAutoConfiguration

@AutoConfiguration(afterName="org.springframework.boot.actuate.autoconfigure.tracing.MicrometerTracingAutoConfiguration") @ConditionalOnClass({io.micrometer.tracing.Tracer.class,MicrometerSpanFactory.class}) @EnableConfigurationProperties(ThreadLocalContextPropagationProperties.class) public class MicrometerTracingAutoConfiguration extends Object
Autoconfiguration that toggles the Micrometer tracing binding when the axoniq-tracing-micrometer module is on the classpath. The binding itself self-wires via ServiceLoader: MicrometerTracingConfigurationEnhancer registers the SpanFactory from the Tracer/Propagator beans (bridged to Axon components by the Spring configurer), and MicrometerThreadLocalContextPropagationConfigurationEnhancer installs the thread-local bridge. This autoconfiguration therefore contributes no wiring beans -- only property-driven toggles: The Tracer, Propagator and ObservationRegistry beans come from Spring Boot's own tracing auto-configuration (Boot 3.5 / 4.0 spring-boot-starter-actuator + a bridge such as micrometer-tracing-bridge-otel).
Since:
5.3.0
Author:
Mateusz Nowak
  • Constructor Details

    • MicrometerTracingAutoConfiguration

      public MicrometerTracingAutoConfiguration()
  • Method Details

    • micrometerTracingDisablingEnhancer

      @Bean @ConditionalOnProperty(prefix="axon.tracing", name="enabled", havingValue="false") public ConfigurationEnhancer micrometerTracingDisablingEnhancer()
      Disables the Micrometer tracing enhancers when axon.tracing.enabled=false, so that even with the module (and a Tracer bean) on the classpath no SpanFactory is registered and every component stays undecorated.
      Returns:
      a ConfigurationEnhancer that disables both Micrometer tracing enhancers
    • threadLocalContextPropagationTogglingEnhancer

      @Bean public ConfigurationEnhancer threadLocalContextPropagationTogglingEnhancer(ThreadLocalContextPropagationProperties properties)
      Disables the MicrometerThreadLocalContextPropagationConfigurationEnhancer -- and with it the UnitOfWorkFactory decorator and thread-local span accessor that make the active Axon span current on the framework's worker threads -- when axon.tracing.thread-local-context-propagation.enabled is false. Core tracing (spans and cross-service propagation) is unaffected. When the property is true (the default) this enhancer does nothing and the ServiceLoader-discovered enhancer installs the bridge as usual.
      Parameters:
      properties - the bound ThreadLocalContextPropagationProperties
      Returns:
      a ConfigurationEnhancer that disables the thread-local bridge when it is switched off