Class AggregateIdentifierSpanAttributesProvider
java.lang.Object
org.axonframework.messaging.tracing.attributes.AggregateIdentifierSpanAttributesProvider
- All Implemented Interfaces:
SpanAttributesProvider
public final class AggregateIdentifierSpanAttributesProvider
extends Object
implements SpanAttributesProvider
Adds the aggregate identifier to the span when one is available on the
ProcessingContext via
LegacyResources.AGGREGATE_IDENTIFIER_KEY. By default the attribute key is DEFAULT_ATTRIBUTE_KEY
(axoniq.aggregate.identifier); a different key can be supplied through the constructor.
This is best-effort: the attribute is present only when a legacy aggregate-based event storage engine populated the resource. It is absent for dynamic-consistency-boundary / entity-based operations and whenever no context is available.
Legacy-only. This provider is exclusively for events produced by a legacy, aggregate-based event store. For
dynamic-consistency-boundary events, tags are recorded by the axon-eventsourcing module's
EventTagsSpanAttributesProvider instead.
- Since:
- 4.6.0
- Author:
- Mateusz Nowak, Mitchell Herrijgers
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault attribute key under which the aggregate identifier is recorded. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a provider recording the aggregate identifier under the defaultDEFAULT_ATTRIBUTE_KEYkey.AggregateIdentifierSpanAttributesProvider(String attributeKey) Creates a provider recording the aggregate identifier under the givenattributeKey. -
Method Summary
Modifier and TypeMethodDescriptionprovideForMessage(Message message, @Nullable ProcessingContext context) Provides the attributes this provider contributes for the givenmessageand optionalcontext.
-
Field Details
-
DEFAULT_ATTRIBUTE_KEY
Default attribute key under which the aggregate identifier is recorded.- See Also:
-
-
Constructor Details
-
AggregateIdentifierSpanAttributesProvider
public AggregateIdentifierSpanAttributesProvider()Creates a provider recording the aggregate identifier under the defaultDEFAULT_ATTRIBUTE_KEYkey. -
AggregateIdentifierSpanAttributesProvider
Creates a provider recording the aggregate identifier under the givenattributeKey.- Parameters:
attributeKey- the span attribute key to record the aggregate identifier under
-
-
Method Details
-
provideForMessage
Description copied from interface:SpanAttributesProviderProvides the attributes this provider contributes for the givenmessageand optionalcontext.- Specified by:
provideForMessagein interfaceSpanAttributesProvider- Parameters:
message- the message the span is created forcontext- the active processing context, ornullwhen none is available- Returns:
- the attributes to add to the span; an empty map when this provider contributes nothing
-