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 (see more)
messaging.system.nameDevelopmentstringThe messaging system as identified by the client instrumentation. [9]activemq; aws.sns; aws.sqs (see more)

[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: SHOULD uniquely identify a specific queue, topic or other entity within the broker. If the broker doesn’t have such notion, it 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 username 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.name: 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.name 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.name 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
azure.eventgridAzure Event GridDevelopment
azure.eventhubsAzure Event HubsDevelopment
azure.servicebusAzure Service BusDevelopment
gcp.pubsubGoogle Cloud Pub/SubDevelopment
jmsJava Message ServiceDevelopment
kafkaApache KafkaDevelopment
pulsarApache PulsarDevelopment
rabbitmqRabbitMQDevelopment
rocketmqApache RocketMQDevelopment

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.eventhubs.message.enqueued_timeDeprecated
Replaced by azure.eventhubs.message.enqueued_time.
intDeprecated, use azure.eventhubs.message.enqueued_time instead.1701393730
messaging.gcp_pubsub.message.ack_deadlineDeprecated
Replaced by gcp.pubsub.message.ack_deadline.
intDeprecated, use gcp.pubsub.message.ack_deadline instead.10
messaging.gcp_pubsub.message.ack_idDeprecated
Replaced by gcp.pubsub.message.ack_id.
stringDeprecated, use gcp.pubsub.message.ack_id instead.ack_id
messaging.gcp_pubsub.message.delivery_attemptDeprecated
Replaced by gcp.pubsub.message.delivery_attempt.
intDeprecated, use gcp.pubsub.message.delivery_attempt instead.2
messaging.gcp_pubsub.message.ordering_keyDeprecated
Replaced by gcp.pubsub.message.ordering_key.
stringDeprecated, use gcp.pubsub.message.ordering_key instead.ordering_key
messaging.kafka.cluster.idDeprecated
Replaced by kafka.cluster.id.
stringDeprecated, use kafka.cluster.id instead. [10]MkU3OEVBNTcwNTJENDM2Qk
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.keyDeprecated
Replaced by kafka.message.key.
stringDeprecated, use kafka.message.key instead. [11]myKey
messaging.kafka.message.offsetDeprecated
Replaced by kafka.offset.
intDeprecated, use kafka.offset instead.42
messaging.kafka.message.tombstoneDeprecated
Replaced by kafka.message.tombstone.
booleanDeprecated, use kafka.message.tombstone instead.
messaging.kafka.offsetDeprecated
Replaced by kafka.offset.
intDeprecated, use kafka.offset instead.42
messaging.operationDeprecated
Replaced by messaging.operation.type.
stringDeprecated, use messaging.operation.type instead.publish; create; process
messaging.rabbitmq.destination.routing_keyDeprecated
Replaced by rabbitmq.destination.routing_key.
stringDeprecated, use rabbitmq.destination.routing_key instead.myKey
messaging.rabbitmq.message.delivery_tagDeprecated
Replaced by rabbitmq.message.delivery_tag.
intDeprecated, use rabbitmq.message.delivery_tag instead.123
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.rocketmq.consumption_modelDeprecated
Replaced by rocketmq.consumption_model.
stringDeprecated, use rocketmq.consumption_model instead.clustering; broadcasting (see more)
messaging.rocketmq.message.delay_time_levelDeprecated
Replaced by rocketmq.message.delay_time_level.
intDeprecated, use rocketmq.message.delay_time_level instead.3
messaging.rocketmq.message.delivery_timestampDeprecated
Replaced by rocketmq.message.delivery_timestamp.
intDeprecated, use rocketmq.message.delivery_timestamp instead.1665987217045
messaging.rocketmq.message.groupDeprecated
Replaced by rocketmq.message.group.
stringDeprecated, use rocketmq.message.group instead.myMessageGroup
messaging.rocketmq.message.keysDeprecated
Replaced by rocketmq.message.keys.
string[]Deprecated, use rocketmq.message.keys instead.["keyA", "keyB"]
messaging.rocketmq.message.tagDeprecated
Replaced by rocketmq.message.tag.
stringDeprecated, use rocketmq.message.tag instead.tagA
messaging.rocketmq.message.typeDeprecated
Replaced by rocketmq.message.type.
stringDeprecated, use rocketmq.message.type instead.normal; fifo; delay (see more)
messaging.rocketmq.namespaceDeprecated
Replaced by rocketmq.namespace.
stringDeprecated, use rocketmq.namespace instead.myNamespace
messaging.servicebus.destination.subscription_nameDeprecated
Replaced by messaging.destination.subscription.name.
stringDeprecated, use messaging.destination.subscription.name instead.subscription-a
messaging.servicebus.disposition_statusDeprecated
Replaced by azure.servicebus.disposition_status.
stringDeprecated, use azure.servicebus.disposition_status instead.complete; abandon; dead_letter (see more)
messaging.servicebus.message.delivery_countDeprecated
Replaced by azure.servicebus.message.delivery_count.
intDeprecated, use azure.servicebus.message.delivery_count instead.2
messaging.servicebus.message.enqueued_timeDeprecated
Replaced by azure.servicebus.message.enqueued_time.
intDeprecated, use azure.servicebus.message.enqueued_time instead.1701393730
messaging.systemDeprecated
Replaced by messaging.system.name.
stringDeprecated, use messaging.system.name instead. [12]activemq; aws.sns; aws_sqs (see more)

[10] messaging.kafka.cluster.id: The cluster ID is a unique identifier reported by the Kafka broker. It identifies the cluster independently of the individual brokers the client is configured to connect to, and remains stable even if broker hostnames, IP addresses, or ports change.

[11] 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.

[12] 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.

When migrating to messaging.system.name, update the following values:

  • aws_sqs to aws.sqs
  • eventgrid to azure.eventgrid
  • eventhubs to azure.eventhubs
  • servicebus to azure.servicebus
  • gcp_pubsub to gcp.pubsub

All other values are unchanged.


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

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

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