Messaging

General Messaging Attributes

Attributes describing telemetry around messaging systems and messaging activities.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
messaging.batch.message_countDevelopmentintThe number of messages sent, received, or processed in the scope of the batching operation. [1]0; 1; 2
messaging.client.idDevelopmentstringA unique identifier for the client that consumes or produces a message.client-5; myhost@8742@s8083jm
messaging.consumer.group.nameDevelopmentstringThe name of the consumer group with which a consumer is associated. [2]my-group; indexer
messaging.destination.anonymousDevelopmentbooleanA boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name).
messaging.destination.nameDevelopmentstringThe message destination name [3]MyQueue; MyTopic
messaging.destination.partition.idDevelopmentstringThe identifier of the partition messages are sent to or received from, unique within the messaging.destination.name.1
messaging.destination.subscription.nameDevelopmentstringThe name of the destination subscription from which a message is consumed. [4]subscription-a
messaging.destination.templateDevelopmentstringLow cardinality representation of the messaging destination name [5]/customers/{customerId}
messaging.destination.temporaryDevelopmentbooleanA boolean that is true if the message destination is temporary and might not exist anymore after messages are processed.
messaging.message.body.sizeDevelopmentintThe size of the message body in bytes. [6]1439
messaging.message.conversation_idDevelopmentstringThe conversation ID identifying the conversation to which the message belongs, represented as a string. Sometimes called “Correlation ID”.MyConversationId
messaging.message.envelope.sizeDevelopmentintThe size of the message body and metadata in bytes. [7]2738
messaging.message.idDevelopmentstringA value used by the messaging system as an identifier for the message, represented as a string.452a7c7c7c7048c2f887f61572b18fc2
messaging.operation.nameDevelopmentstringThe system-specific name of the messaging operation.ack; nack; send
messaging.operation.typeDevelopmentstringA string identifying the type of the messaging operation. [8]create; send; receive
messaging.systemDevelopmentstringThe messaging system as identified by the client instrumentation. [9]activemq; aws.sns; aws_sqs

[1] messaging.batch.message_count: Instrumentations SHOULD NOT set messaging.batch.message_count on spans that operate with a single message. When a messaging client library supports both batch and single-message API for the same operation, instrumentations SHOULD use messaging.batch.message_count for batching APIs and SHOULD NOT use it for single-message APIs.

[2] messaging.consumer.group.name: Semantic conventions for individual messaging systems SHOULD document whether messaging.consumer.group.name is applicable and what it means in the context of that system.

[3] messaging.destination.name: Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker. If the broker doesn’t have such notion, the destination name SHOULD uniquely identify the broker.

[4] messaging.destination.subscription.name: Semantic conventions for individual messaging systems SHOULD document whether messaging.destination.subscription.name is applicable and what it means in the context of that system.

[5] messaging.destination.template: Destination names could be constructed from templates. An example would be a destination name involving a user name or product id. Although the destination name in this case is of high cardinality, the underlying template is of low cardinality and can be effectively used for grouping and aggregation.

[6] messaging.message.body.size: This can refer to both the compressed or uncompressed body size. If both sizes are known, the uncompressed body size should be used.

[7] messaging.message.envelope.size: This can refer to both the compressed or uncompressed size. If both sizes are known, the uncompressed size should be used.

[8] messaging.operation.type: If a custom value is used, it MUST be of low cardinality.

[9] messaging.system: The actual messaging system may differ from the one known by the client. For example, when using Kafka client libraries to communicate with Azure Event Hubs, the messaging.system is set to kafka based on the instrumentation’s best knowledge.


messaging.operation.type has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
createA message is created. “Create” spans always refer to a single message and are used to provide a unique creation context for messages in batch sending scenarios.Development
processOne or more messages are processed by a consumer.Development
receiveOne or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages.Development
sendOne or more messages are provided for sending to an intermediary. If a single message is sent, the context of the “Send” span can be used as the creation context and no “Create” span needs to be created.Development
settleOne or more messages are settled.Development

messaging.system has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
activemqApache ActiveMQDevelopment
aws.snsAmazon Simple Notification Service (SNS)Development
aws_sqsAmazon Simple Queue Service (SQS)Development
eventgridAzure Event GridDevelopment
eventhubsAzure Event HubsDevelopment
gcp_pubsubGoogle Cloud Pub/SubDevelopment
jmsJava Message ServiceDevelopment
kafkaApache KafkaDevelopment
pulsarApache PulsarDevelopment
rabbitmqRabbitMQDevelopment
rocketmqApache RocketMQDevelopment
servicebusAzure Service BusDevelopment

Azure Event Hubs Attributes

This group describes attributes specific to Azure Event Hubs.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
messaging.eventhubs.message.enqueued_timeDevelopmentintThe UTC epoch seconds at which the message has been accepted and stored in the entity.1701393730

GCP Pub/Sub Attributes

This group describes attributes specific to GCP Pub/Sub.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
messaging.gcp_pubsub.message.ack_deadlineDevelopmentintThe ack deadline in seconds set for the modify ack deadline request.10
messaging.gcp_pubsub.message.ack_idDevelopmentstringThe ack id for a given message.ack_id
messaging.gcp_pubsub.message.delivery_attemptDevelopmentintThe delivery attempt for a given message.2
messaging.gcp_pubsub.message.ordering_keyDevelopmentstringThe ordering key for a given message. If the attribute is not present, the message does not have an ordering key.ordering_key

Kafka Attributes

This group describes attributes specific to Apache Kafka.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
messaging.kafka.message.keyDevelopmentstringMessage keys in Kafka are used for grouping alike messages to ensure they’re processed on the same partition. They differ from messaging.message.id in that they’re not unique. If the key is null, the attribute MUST NOT be set. [10]myKey
messaging.kafka.message.tombstoneDevelopmentbooleanA boolean that is true if the message is a tombstone.
messaging.kafka.offsetDevelopmentintThe offset of a record in the corresponding Kafka partition.42

[10] messaging.kafka.message.key: If the key type is not string, it’s string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don’t include its value.

RabbitMQ Attributes

This group describes attributes specific to RabbitMQ.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
messaging.rabbitmq.destination.routing_keyDevelopmentstringRabbitMQ message routing key.myKey
messaging.rabbitmq.message.delivery_tagDevelopmentintRabbitMQ message delivery tag123

RocketMQ Attributes

This group describes attributes specific to RocketMQ.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
messaging.rocketmq.consumption_modelDevelopmentstringModel of message consumption. This only applies to consumer spans.clustering; broadcasting
messaging.rocketmq.message.delay_time_levelDevelopmentintThe delay time level for delay message, which determines the message delay time.3
messaging.rocketmq.message.delivery_timestampDevelopmentintThe timestamp in milliseconds that the delay message is expected to be delivered to consumer.1665987217045
messaging.rocketmq.message.groupDevelopmentstringIt is essential for FIFO message. Messages that belong to the same message group are always processed one by one within the same consumer group.myMessageGroup
messaging.rocketmq.message.keysDevelopmentstring[]Key(s) of message, another way to mark message besides message id.["keyA", "keyB"]
messaging.rocketmq.message.tagDevelopmentstringThe secondary classifier of message besides topic.tagA
messaging.rocketmq.message.typeDevelopmentstringType of message.normal; fifo; delay
messaging.rocketmq.namespaceDevelopmentstringNamespace of RocketMQ resources, resources in different namespaces are individual.myNamespace

messaging.rocketmq.consumption_model has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
broadcastingBroadcasting consumption modelDevelopment
clusteringClustering consumption modelDevelopment

messaging.rocketmq.message.type has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
delayDelay messageDevelopment
fifoFIFO messageDevelopment
normalNormal messageDevelopment
transactionTransaction messageDevelopment

Azure Service Bus Attributes

This group describes attributes specific to Azure Service Bus.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
messaging.servicebus.disposition_statusDevelopmentstringDescribes the settlement type.complete; abandon; dead_letter
messaging.servicebus.message.delivery_countDevelopmentintNumber of deliveries that have been attempted for this message.2
messaging.servicebus.message.enqueued_timeDevelopmentintThe UTC epoch seconds at which the message has been accepted and stored in the entity.1701393730

messaging.servicebus.disposition_status has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
abandonMessage is abandonedDevelopment
completeMessage is completedDevelopment
dead_letterMessage is sent to dead letter queueDevelopment
deferMessage is deferredDevelopment

Deprecated Messaging Attributes

Describes deprecated messaging attributes.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
messaging.client_idDeprecated
Replaced by messaging.client.id.
stringDeprecated, use messaging.client.id instead.client-5; myhost@8742@s8083jm
messaging.destination_publish.anonymousDeprecated
Removed. No replacement at this time.
booleanDeprecated, no replacement at this time.
messaging.destination_publish.nameDeprecated
Removed. No replacement at this time.
stringDeprecated, no replacement at this time.MyQueue; MyTopic
messaging.eventhubs.consumer.groupDeprecated
Replaced by messaging.consumer.group.name.
stringDeprecated, use messaging.consumer.group.name instead.$Default
messaging.kafka.consumer.groupDeprecated
Replaced by messaging.consumer.group.name.
stringDeprecated, use messaging.consumer.group.name instead.my-group
messaging.kafka.destination.partitionDeprecated
Record string representation of the partition id in messaging.destination.partition.id attribute.
intDeprecated, use messaging.destination.partition.id instead.2
messaging.kafka.message.offsetDeprecated
Replaced by messaging.kafka.offset.
intDeprecated, use messaging.kafka.offset instead.42
messaging.operationDeprecated
Replaced by messaging.operation.type.
stringDeprecated, use messaging.operation.type instead.publish; create; process
messaging.rocketmq.client_groupDeprecated
Replaced by messaging.consumer.group.name on the consumer spans. No replacement for producer spans.
stringDeprecated, use messaging.consumer.group.name instead.myConsumerGroup
messaging.servicebus.destination.subscription_nameDeprecated
Replaced by messaging.destination.subscription.name.
stringDeprecated, use messaging.destination.subscription.name instead.subscription-a