Interface SpanAttributesProvider

All Known Implementing Classes:
AggregateIdentifierSpanAttributesProvider, EventTagsSpanAttributesProvider, MessageIdSpanAttributesProvider, MessageTypeSpanAttributesProvider, MetadataSpanAttributesProvider
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Internal @FunctionalInterface public interface SpanAttributesProvider
Contributes attributes to a Span based on the Message the span is created for. Multiple providers compose; the order in which they are invoked is unspecified.

The context parameter is Nullable because some span-creation points have no ProcessingContext available. Providers that do not need the context ignore it; providers that do need it (for example AggregateIdentifierSpanAttributesProvider, which reads from LegacyResources.AGGREGATE_IDENTIFIER_KEY) MUST handle null gracefully.

Implementations MUST NOT depend on message types that have been removed from the framework.

Since:
4.6.0
Author:
Mateusz Nowak, Mitchell Herrijgers
  • Method Summary

    Modifier and Type
    Method
    Description
    provideForMessage(Message message, @Nullable ProcessingContext context)
    Provides the attributes this provider contributes for the given message and optional context.
  • Method Details

    • provideForMessage

      Map<String,String> provideForMessage(Message message, @Nullable ProcessingContext context)
      Provides the attributes this provider contributes for the given message and optional context.
      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