Record Class MessagingTracingSettings
java.lang.Object
java.lang.Record
org.axonframework.messaging.tracing.configuration.MessagingTracingSettings
- Record Components:
commandBusEnabled- whether theCommandBusis decorated with tracingeventSinkEnabled- whether theEventSinkis decorated with tracingeventProcessorEnabled- whether event-handling components (event processors) are decorated with tracingeventProcessorBatchTraceEnabled- whether streaming-processor batches get an enclosing batch span; when disabled, each event handler span becomes a trace root of its owneventProcessorDistributedInSameTrace- whentrue, a handler span continues the publisher's trace; whenfalse(default), it is parented to the streaming batch and links back to the publisher, or starts a linked trace if batch tracing is disabledeventProcessorDistributedInSameTraceTimeLimit- how recent an event must be to continue the publisher's trace whendistributedInSameTraceistrue; older events (e.g. replays) start their own trace linked back to the publisher (defaultPT2M)queryBusEnabled- whether theQueryBusis decorated with tracingeventSourcingHandlersEnabled- whentrue,@EventSourcingHandlerinvocations get their own per-method span; defaults tofalsebecause event sourcing handlers fire once per event during entity replay and would flood tracesspanAttributesProviders- toggles for the built-in span attribute providers contributed by this module
public record MessagingTracingSettings(boolean commandBusEnabled, boolean eventSinkEnabled, boolean eventProcessorEnabled, boolean eventProcessorBatchTraceEnabled, boolean eventProcessorDistributedInSameTrace, Duration eventProcessorDistributedInSameTraceTimeLimit, boolean queryBusEnabled, boolean eventSourcingHandlersEnabled, MessagingTracingSettings.SpanAttributesProviders spanAttributesProviders)
extends Record
Per-component on/off toggles for messaging tracing, read by
MessagingTracingConfigurationEnhancer to decide
which axon-messaging components to decorate.
When no instance is registered, every component defaults to enabled (enabledByDefault()). To adjust the
toggles declaratively, register an instance as a component -- typically starting from the defaults and using the
with* copy methods:
configurer.componentRegistry(cr -> cr.registerComponent(
MessagingTracingSettings.class,
c -> MessagingTracingSettings.enabledByDefault().withEventProcessorDistributedInSameTrace(true)));
Higher-level integrations (for example property-based configuration layers) register a translated instance on the
application's behalf; an explicitly registered component always takes precedence.- Since:
- 5.3.0
- Author:
- Mateusz Nowak
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordToggles for the built-inSpanAttributesProviderscontributed by theaxon-messagingmodule (read byMessagingSpanAttributesProviderConfigurationEnhancer). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationDefault time limit fordistributedInSameTrace. -
Constructor Summary
ConstructorsConstructorDescriptionMessagingTracingSettings(boolean commandBusEnabled, boolean eventSinkEnabled, boolean eventProcessorEnabled, boolean eventProcessorBatchTraceEnabled, boolean eventProcessorDistributedInSameTrace, Duration eventProcessorDistributedInSameTraceTimeLimit, boolean queryBusEnabled, boolean eventSourcingHandlersEnabled, MessagingTracingSettings.SpanAttributesProviders spanAttributesProviders) Creates an instance of aMessagingTracingSettingsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecommandBusEnabledrecord component.static MessagingTracingSettingsReturns the default settings, with every messaging component enabled for tracing and default values for the event-processor sub-toggles (batchTraceEnabled=true,distributedInSameTrace=false,distributedInSameTraceTimeLimit=PT2M) and the handler enhancer (eventSourcingHandlersEnabled=false-- replay-noisy event sourcing handlers are not traced).final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theeventProcessorBatchTraceEnabledrecord component.booleanReturns the value of theeventProcessorDistributedInSameTracerecord component.Returns the value of theeventProcessorDistributedInSameTraceTimeLimitrecord component.booleanReturns the value of theeventProcessorEnabledrecord component.booleanReturns the value of theeventSinkEnabledrecord component.booleanReturns the value of theeventSourcingHandlersEnabledrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thequeryBusEnabledrecord component.Returns the value of thespanAttributesProvidersrecord component.final StringtoString()Returns a string representation of this record class.withCommandBusEnabled(boolean commandBusEnabled) Returns a copy of these settings withcommandBusEnabled()replaced by the given value.withEventProcessorBatchTraceEnabled(boolean eventProcessorBatchTraceEnabled) Returns a copy of these settings witheventProcessorBatchTraceEnabled()replaced by the given value.withEventProcessorDistributedInSameTrace(boolean eventProcessorDistributedInSameTrace) Returns a copy of these settings witheventProcessorDistributedInSameTrace()replaced by the given value.withEventProcessorDistributedInSameTraceTimeLimit(Duration eventProcessorDistributedInSameTraceTimeLimit) Returns a copy of these settings witheventProcessorDistributedInSameTraceTimeLimit()replaced by the given value.withEventProcessorEnabled(boolean eventProcessorEnabled) Returns a copy of these settings witheventProcessorEnabled()replaced by the given value.withEventSinkEnabled(boolean eventSinkEnabled) Returns a copy of these settings witheventSinkEnabled()replaced by the given value.withEventSourcingHandlersEnabled(boolean eventSourcingHandlersEnabled) Returns a copy of these settings witheventSourcingHandlersEnabled()replaced by the given value.withQueryBusEnabled(boolean queryBusEnabled) Returns a copy of these settings withqueryBusEnabled()replaced by the given value.withSpanAttributesProviders(MessagingTracingSettings.SpanAttributesProviders spanAttributesProviders) Returns a copy of these settings withspanAttributesProviders()replaced by the given value.
-
Field Details
-
DEFAULT_DISTRIBUTED_IN_SAME_TRACE_TIME_LIMIT
Default time limit fordistributedInSameTrace.
-
-
Constructor Details
-
MessagingTracingSettings
public MessagingTracingSettings(boolean commandBusEnabled, boolean eventSinkEnabled, boolean eventProcessorEnabled, boolean eventProcessorBatchTraceEnabled, boolean eventProcessorDistributedInSameTrace, Duration eventProcessorDistributedInSameTraceTimeLimit, boolean queryBusEnabled, boolean eventSourcingHandlersEnabled, MessagingTracingSettings.SpanAttributesProviders spanAttributesProviders) Creates an instance of aMessagingTracingSettingsrecord class.- Parameters:
commandBusEnabled- the value for thecommandBusEnabledrecord componenteventSinkEnabled- the value for theeventSinkEnabledrecord componenteventProcessorEnabled- the value for theeventProcessorEnabledrecord componenteventProcessorBatchTraceEnabled- the value for theeventProcessorBatchTraceEnabledrecord componenteventProcessorDistributedInSameTrace- the value for theeventProcessorDistributedInSameTracerecord componenteventProcessorDistributedInSameTraceTimeLimit- the value for theeventProcessorDistributedInSameTraceTimeLimitrecord componentqueryBusEnabled- the value for thequeryBusEnabledrecord componenteventSourcingHandlersEnabled- the value for theeventSourcingHandlersEnabledrecord componentspanAttributesProviders- the value for thespanAttributesProvidersrecord component
-
-
Method Details
-
enabledByDefault
Returns the default settings, with every messaging component enabled for tracing and default values for the event-processor sub-toggles (batchTraceEnabled=true,distributedInSameTrace=false,distributedInSameTraceTimeLimit=PT2M) and the handler enhancer (eventSourcingHandlersEnabled=false-- replay-noisy event sourcing handlers are not traced). Every built-in span attribute provider is enabled.- Returns:
- the all-enabled default settings
-
withCommandBusEnabled
Returns a copy of these settings withcommandBusEnabled()replaced by the given value.- Parameters:
commandBusEnabled- whether theCommandBusis decorated with tracing- Returns:
- a copy of these settings with the given
commandBusEnabled
-
withEventSinkEnabled
Returns a copy of these settings witheventSinkEnabled()replaced by the given value.- Parameters:
eventSinkEnabled- whether theEventSinkis decorated with tracing- Returns:
- a copy of these settings with the given
eventSinkEnabled
-
withEventProcessorEnabled
Returns a copy of these settings witheventProcessorEnabled()replaced by the given value.- Parameters:
eventProcessorEnabled- whether event-handling components (event processors) are decorated with tracing- Returns:
- a copy of these settings with the given
eventProcessorEnabled
-
withEventProcessorBatchTraceEnabled
public MessagingTracingSettings withEventProcessorBatchTraceEnabled(boolean eventProcessorBatchTraceEnabled) Returns a copy of these settings witheventProcessorBatchTraceEnabled()replaced by the given value.- Parameters:
eventProcessorBatchTraceEnabled- whether streaming-processor batches get an enclosing batch span- Returns:
- a copy of these settings with the given
eventProcessorBatchTraceEnabled
-
withEventProcessorDistributedInSameTrace
public MessagingTracingSettings withEventProcessorDistributedInSameTrace(boolean eventProcessorDistributedInSameTrace) Returns a copy of these settings witheventProcessorDistributedInSameTrace()replaced by the given value.- Parameters:
eventProcessorDistributedInSameTrace- whentrue, a handler span continues the publisher's trace- Returns:
- a copy of these settings with the given
eventProcessorDistributedInSameTrace
-
withEventProcessorDistributedInSameTraceTimeLimit
public MessagingTracingSettings withEventProcessorDistributedInSameTraceTimeLimit(Duration eventProcessorDistributedInSameTraceTimeLimit) Returns a copy of these settings witheventProcessorDistributedInSameTraceTimeLimit()replaced by the given value.- Parameters:
eventProcessorDistributedInSameTraceTimeLimit- how recent an event must be to continue the publisher's trace whendistributedInSameTraceistrue- Returns:
- a copy of these settings with the given
eventProcessorDistributedInSameTraceTimeLimit
-
withQueryBusEnabled
Returns a copy of these settings withqueryBusEnabled()replaced by the given value.- Parameters:
queryBusEnabled- whether theQueryBusis decorated with tracing- Returns:
- a copy of these settings with the given
queryBusEnabled
-
withEventSourcingHandlersEnabled
public MessagingTracingSettings withEventSourcingHandlersEnabled(boolean eventSourcingHandlersEnabled) Returns a copy of these settings witheventSourcingHandlersEnabled()replaced by the given value.- Parameters:
eventSourcingHandlersEnabled- whether@EventSourcingHandlerinvocations get their own span- Returns:
- a copy of these settings with the given
eventSourcingHandlersEnabled
-
withSpanAttributesProviders
public MessagingTracingSettings withSpanAttributesProviders(MessagingTracingSettings.SpanAttributesProviders spanAttributesProviders) Returns a copy of these settings withspanAttributesProviders()replaced by the given value.- Parameters:
spanAttributesProviders- toggles for the built-in span attribute providers contributed by this module- Returns:
- a copy of these settings with the given
spanAttributesProviders
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
commandBusEnabled
public boolean commandBusEnabled()Returns the value of thecommandBusEnabledrecord component.- Returns:
- the value of the
commandBusEnabledrecord component
-
eventSinkEnabled
public boolean eventSinkEnabled()Returns the value of theeventSinkEnabledrecord component.- Returns:
- the value of the
eventSinkEnabledrecord component
-
eventProcessorEnabled
public boolean eventProcessorEnabled()Returns the value of theeventProcessorEnabledrecord component.- Returns:
- the value of the
eventProcessorEnabledrecord component
-
eventProcessorBatchTraceEnabled
public boolean eventProcessorBatchTraceEnabled()Returns the value of theeventProcessorBatchTraceEnabledrecord component.- Returns:
- the value of the
eventProcessorBatchTraceEnabledrecord component
-
eventProcessorDistributedInSameTrace
public boolean eventProcessorDistributedInSameTrace()Returns the value of theeventProcessorDistributedInSameTracerecord component.- Returns:
- the value of the
eventProcessorDistributedInSameTracerecord component
-
eventProcessorDistributedInSameTraceTimeLimit
Returns the value of theeventProcessorDistributedInSameTraceTimeLimitrecord component.- Returns:
- the value of the
eventProcessorDistributedInSameTraceTimeLimitrecord component
-
queryBusEnabled
public boolean queryBusEnabled()Returns the value of thequeryBusEnabledrecord component.- Returns:
- the value of the
queryBusEnabledrecord component
-
eventSourcingHandlersEnabled
public boolean eventSourcingHandlersEnabled()Returns the value of theeventSourcingHandlersEnabledrecord component.- Returns:
- the value of the
eventSourcingHandlersEnabledrecord component
-
spanAttributesProviders
Returns the value of thespanAttributesProvidersrecord component.- Returns:
- the value of the
spanAttributesProvidersrecord component
-