Interface MessagingAttributesGetter<REQUEST,RESPONSE>


public interface MessagingAttributesGetter<REQUEST,RESPONSE>
An interface for getting messaging attributes.

Instrumentation authors will create implementations of this interface for their specific library/framework. It will be used by the MessagingAttributesExtractor to obtain the various messaging attributes in a type-generic way.

  • Method Details

    • getSystem

      @Nullable String getSystem(REQUEST request)
    • getDestination

      @Nullable String getDestination(REQUEST request)
    • getDestinationTemplate

      @Nullable String getDestinationTemplate(REQUEST request)
    • isTemporaryDestination

      boolean isTemporaryDestination(REQUEST request)
    • isAnonymousDestination

      boolean isAnonymousDestination(REQUEST request)
    • getConversationId

      @Nullable String getConversationId(REQUEST request)
    • getMessageBodySize

      @Nullable Long getMessageBodySize(REQUEST request)
    • getMessageEnvelopeSize

      @Nullable Long getMessageEnvelopeSize(REQUEST request)
    • getMessageId

      @Nullable String getMessageId(REQUEST request, @Nullable RESPONSE response)
    • getClientId

      @Nullable String getClientId(REQUEST request)
    • getBatchMessageCount

      @Nullable Long getBatchMessageCount(REQUEST request, @Nullable RESPONSE response)
    • getDestinationPartitionId

      @Nullable default String getDestinationPartitionId(REQUEST request)
    • getDestinationSubscriptionName

      @Nullable default String getDestinationSubscriptionName(REQUEST request)
      Returns the name of the destination subscription from which a message is consumed, or null if there is none.

      This attribute only exists in the v1.43 messaging semantic conventions.

    • getErrorType

      @Nullable default String getErrorType(REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)
      Returns a description of a class of error the operation ended with.

      If this method returns null, the exception class name (if any) will be used as error type.

      The cardinality of the error type should be low. The instrumentations implementing this method are recommended to document the custom values they support.

    • getMessageHeader

      default List<String> getMessageHeader(REQUEST request, String name)
      Extracts all values of header named name from the request, or an empty list if there were none.

      Implementations of this method must not return a null value; an empty list should be returned instead.

    • getMessageHeaderNames

      default Iterable<String> getMessageHeaderNames(REQUEST request)
      Extracts the names of all headers present on the request, or an empty iterable if there were none.

      This is used to resolve header selectors that cannot be turned into a list of exact header names, such as selectors containing wildcard patterns or selectors that only exclude headers. Selectors that only list exact header names are resolved with getMessageHeader(Object, String) alone. To preserve compatibility with existing implementations, overriding this method is optional until 3.0.

      Implementations of this method must not return a null value; an empty iterable should be returned instead. The returned iterable is only read, so implementations may return a view over the underlying header names as long as that view cannot change while the returned iterable is being read.