Class MessageIdSpanAttributesProvider

java.lang.Object
org.axonframework.messaging.tracing.attributes.MessageIdSpanAttributesProvider
All Implemented Interfaces:
SpanAttributesProvider

public final class MessageIdSpanAttributesProvider extends Object implements SpanAttributesProvider
Adds the message identifier to the span. By default the attribute key is DEFAULT_ATTRIBUTE_KEY (axoniq.message.id); a different key can be supplied through the constructor.
Since:
4.6.0
Author:
Mateusz Nowak, Mitchell Herrijgers
  • Field Details

    • DEFAULT_ATTRIBUTE_KEY

      public static final String DEFAULT_ATTRIBUTE_KEY
      Default attribute key under which the message identifier is recorded.
      See Also:
  • Constructor Details

    • MessageIdSpanAttributesProvider

      public MessageIdSpanAttributesProvider()
      Creates a provider recording the message identifier under the default DEFAULT_ATTRIBUTE_KEY key.
    • MessageIdSpanAttributesProvider

      public MessageIdSpanAttributesProvider(String attributeKey)
      Creates a provider recording the message identifier under the given attributeKey.
      Parameters:
      attributeKey - the span attribute key to record the message identifier under
  • Method Details

    • provideForMessage

      public Map<String,String> provideForMessage(Message message, @Nullable ProcessingContext context)
      Description copied from interface: SpanAttributesProvider
      Provides the attributes this provider contributes for the given message and optional context.
      Specified by:
      provideForMessage in interface SpanAttributesProvider
      Parameters:
      message - the message the span is created for
      context - the active processing context, or null when none is available
      Returns:
      the attributes to add to the span; an empty map when this provider contributes nothing