Messaging

Generic Messaging Attributes

AttributeTypeDescriptionExamplesStability
messaging.batch.message_countintThe number of messages sent, received, or processed in the scope of the batching operation. [1]0; 1; 2Experimental
messaging.client_idstringA unique identifier for the client that consumes or produces a message.client-5; myhost@8742@s8083jmExperimental
messaging.destination.anonymousbooleanA boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name).Experimental
messaging.destination.namestringThe message destination name [2]MyQueue; MyTopicExperimental
messaging.destination.partition.idstringThe identifier of the partition messages are sent to or received from, unique within the messaging.destination.name.1Experimental
messaging.destination.templatestringLow cardinality representation of the messaging destination name [3]/customers/{customerId}Experimental
messaging.destination.temporarybooleanA boolean that is true if the message destination is temporary and might not exist anymore after messages are processed.Experimental
messaging.destination_publish.anonymousbooleanA boolean that is true if the publish message destination is anonymous (could be unnamed or have auto-generated name).Experimental
messaging.destination_publish.namestringThe name of the original destination the message was published to [4]MyQueue; MyTopicExperimental
messaging.message.body.sizeintThe size of the message body in bytes. [5]1439Experimental
messaging.message.conversation_idstringThe conversation ID identifying the conversation to which the message belongs, represented as a string. Sometimes called “Correlation ID”.MyConversationIdExperimental
messaging.message.envelope.sizeintThe size of the message body and metadata in bytes. [6]2738Experimental
messaging.message.idstringA value used by the messaging system as an identifier for the message, represented as a string.452a7c7c7c7048c2f887f61572b18fc2Experimental
messaging.operationstringA string identifying the kind of messaging operation. [7]publishExperimental
messaging.systemstringAn identifier for the messaging system being used. See below for a list of well-known identifiers.activemqExperimental

[1]: 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]: 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.

[3]: 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.

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

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

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

[7]: If a custom value is used, it MUST be of low cardinality.

messaging.operation 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
publishOne or more messages are provided for publishing to an intermediary. If a single message is published, the context of the “Publish” span can be used as the creation context and no “Create” span needs to be created.Experimental
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 publishing scenarios.Experimental
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.Experimental
processOne or more messages are delivered to or processed by a consumer.Experimental
settleOne or more messages are settled.Experimental

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 ActiveMQExperimental
aws_sqsAmazon Simple Queue Service (SQS)Experimental
eventgridAzure Event GridExperimental
eventhubsAzure Event HubsExperimental
servicebusAzure Service BusExperimental
gcp_pubsubGoogle Cloud Pub/SubExperimental
jmsJava Message ServiceExperimental
kafkaApache KafkaExperimental
rabbitmqRabbitMQExperimental
rocketmqApache RocketMQExperimental

GCP Pub/Sub Attributes

AttributeTypeDescriptionExamplesStability
messaging.gcp_pubsub.message.ordering_keystringThe ordering key for a given message. If the attribute is not present, the message does not have an ordering key.ordering_keyExperimental

Kafka Attributes

AttributeTypeDescriptionExamplesStability
messaging.kafka.consumer.groupstringName of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers.my-groupExperimental
messaging.kafka.message.keystringMessage 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. [1]myKeyExperimental
messaging.kafka.message.offsetintThe offset of a record in the corresponding Kafka partition.42Experimental
messaging.kafka.message.tombstonebooleanA boolean that is true if the message is a tombstone.Experimental

[1]: 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

AttributeTypeDescriptionExamplesStability
messaging.rabbitmq.destination.routing_keystringRabbitMQ message routing key.myKeyExperimental
messaging.rabbitmq.message.delivery_tagintRabbitMQ message delivery tag123Experimental

RocketMQ Attributes

AttributeTypeDescriptionExamplesStability
messaging.rocketmq.client_groupstringName of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind.myConsumerGroupExperimental
messaging.rocketmq.consumption_modelstringModel of message consumption. This only applies to consumer spans.clusteringExperimental
messaging.rocketmq.message.delay_time_levelintThe delay time level for delay message, which determines the message delay time.3Experimental
messaging.rocketmq.message.delivery_timestampintThe timestamp in milliseconds that the delay message is expected to be delivered to consumer.1665987217045Experimental
messaging.rocketmq.message.groupstringIt is essential for FIFO message. Messages that belong to the same message group are always processed one by one within the same consumer group.myMessageGroupExperimental
messaging.rocketmq.message.keysstring[]Key(s) of message, another way to mark message besides message id.[keyA, keyB]Experimental
messaging.rocketmq.message.tagstringThe secondary classifier of message besides topic.tagAExperimental
messaging.rocketmq.message.typestringType of message.normalExperimental
messaging.rocketmq.namespacestringNamespace of RocketMQ resources, resources in different namespaces are individual.myNamespaceExperimental

messaging.rocketmq.consumption_model MUST be one of the following:

ValueDescriptionStability
clusteringClustering consumption modelExperimental
broadcastingBroadcasting consumption modelExperimental

messaging.rocketmq.message.type MUST be one of the following:

ValueDescriptionStability
normalNormal messageExperimental
fifoFIFO messageExperimental
delayDelay messageExperimental
transactionTransaction messageExperimental

Azure Event Hubs Attributes

AttributeTypeDescriptionExamplesStability
messaging.eventhubs.consumer.groupstringThe name of the consumer group the event consumer is associated with.indexerExperimental
messaging.eventhubs.message.enqueued_timeintThe UTC epoch seconds at which the message has been accepted and stored in the entity.1701393730Experimental

Azure Service Bus Attributes

AttributeTypeDescriptionExamplesStability
messaging.servicebus.destination.subscription_namestringThe name of the subscription in the topic messages are received from.mySubscriptionExperimental
messaging.servicebus.disposition_statusstringDescribes the settlement type.completeExperimental
messaging.servicebus.message.delivery_countintNumber of deliveries that have been attempted for this message.2Experimental
messaging.servicebus.message.enqueued_timeintThe UTC epoch seconds at which the message has been accepted and stored in the entity.1701393730Experimental

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
completeMessage is completedExperimental
abandonMessage is abandonedExperimental
dead_letterMessage is sent to dead letter queueExperimental
deferMessage is deferredExperimental

Deprecated Messaging Attributes

AttributeTypeDescriptionExamplesStability
messaging.kafka.destination.partitionint“Deprecated, use messaging.destination.partition.id instead.”2Deprecated
Replaced by messaging.destination.partition.id.