semantic-conventions/model/trace/messaging.yaml

326 lines
13 KiB
YAML

groups:
- id: messaging.message
prefix: messaging
type: attribute_group
brief: 'Semantic convention describing per-message attributes populated on messaging spans or links.'
attributes:
- ref: messaging.destination.name
- id: message.id
type: string
brief: 'A value used by the messaging system as an identifier for the message, represented as a string.'
examples: '452a7c7c7c7048c2f887f61572b18fc2'
- id: message.conversation_id
type: string
brief: >
The [conversation ID](#conversations) identifying the conversation to which the message belongs,
represented as a string. Sometimes called "Correlation ID".
examples: 'MyConversationId'
- id: message.envelope.size
type: int
brief: >
The size of the message body and metadata in bytes.
note: |
This can refer to both the compressed or uncompressed size. If both sizes are known, the uncompressed
size should be used.
examples: 2738
- id: message.body.size
type: int
brief: >
The size of the message body in bytes.
note: |
This can refer to both the compressed or uncompressed body size. If both sizes are known, the uncompressed
body size should be used.
examples: 1439
- id: messaging.destination
prefix: messaging.destination
type: attribute_group
brief: 'Semantic convention for attributes that describe messaging destination on broker'
note: |
Destination attributes should be set on publish, receive, or other spans
describing messaging operations.
Destination attributes should be set when the messaging operation handles
single messages. When the operation handles a batch of messages,
the destination attributes should only be applied when the attribute value
applies to all messages in the batch.
In other cases, destination attributes may be set on links.
attributes:
- id: name
type: string
brief: 'The message destination name'
note: |
Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker. If
the broker does not have such notion, the destination name SHOULD uniquely identify the broker.
examples: ['MyQueue', 'MyTopic']
- id: template
type: string
brief: Low cardinality representation of the messaging destination name
note: >
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.
examples: ['/customers/{customerId}']
- id: temporary
type: boolean
brief: 'A boolean that is true if the message destination is temporary and might not exist anymore after messages are processed.'
- id: anonymous
type: boolean
brief: 'A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name).'
- id: messaging.destination_publish
prefix: messaging.destination_publish
type: attribute_group
brief: >
Semantic convention for attributes that describe the publish messaging destination on broker.
The term Publish Destination refers to the destination the message was originally published to.
These attributes should be used on the consumer side when information about
the publish destination is available and different than the destination message are consumed from.
note: |
Publish destination attributes should be set on publish, receive,
or other spans describing messaging operations.
Destination attributes should be set when the messaging operation handles
single messages. When the operation handles a batch of messages,
the destination attributes should only be applied when the attribute value
applies to all messages in the batch.
In other cases, destination attributes may be set on links.
attributes:
- id: name
type: string
brief: 'The name of the original destination the message was published to'
note: |
The name SHOULD uniquely identify a specific queue, topic, or other entity within the broker. If
the broker does not have such notion, the original destination name SHOULD uniquely identify the broker.
examples: ['MyQueue', 'MyTopic']
- id: anonymous
type: boolean
brief: 'A boolean that is true if the publish message destination is anonymous (could be unnamed or have auto-generated name).'
- id: messaging
prefix: messaging
type: span
brief: >
This document defines general attributes used in
messaging systems.
attributes:
- id: system
type: string
requirement_level: required
brief: 'A string identifying the messaging system.'
examples: ['kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS']
- id: operation
type:
allow_custom_values: true
members:
- id: publish
value: "publish"
- id: receive
value: "receive"
- id: process
value: "process"
requirement_level: required
brief: >
A string identifying the kind of messaging operation as defined in the
[Operation names](#operation-names) section above.
note: If a custom value is used, it MUST be of low cardinality.
- id: batch.message_count
type: int
brief: The number of messages sent, received, or processed in the scope of the batching operation.
requirement_level:
conditionally_required: If the span describes an operation on a batch of messages.
note: >
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.
examples: [0, 1, 2]
- id: client_id
type: string
requirement_level:
recommended: If a client id is available
brief: >
A unique identifier for the client that consumes or produces a message.
examples: ['client-5', 'myhost@8742@s8083jm']
- ref: messaging.destination.name
requirement_level:
conditionally_required: If span describes operation on a single message or if the value applies to all messages in the batch.
- ref: messaging.destination.template
requirement_level:
conditionally_required: >
If available. Instrumentations MUST NOT use `messaging.destination.name` as template
unless low-cardinality of destination name is guaranteed.
- ref: messaging.destination.temporary
requirement_level:
conditionally_required: If value is `true`. When missing, the value is assumed to be `false`.
- ref: messaging.destination.anonymous
requirement_level:
conditionally_required: If value is `true`. When missing, the value is assumed to be `false`.
- ref: messaging.message.id
requirement_level:
recommended: Only for spans that represent an operation on a single message.
- ref: messaging.message.conversation_id
requirement_level:
recommended: Only if span represents operation on a single message.
- ref: messaging.message.envelope.size
requirement_level:
recommended: Only if span represents operation on a single message.
- ref: messaging.message.body.size
requirement_level:
recommended: Only if span represents operation on a single message.
- ref: server.address
note: >
This should be the IP/hostname of the broker (or other network-level peer) this specific message is sent to/received from.
requirement_level:
conditionally_required: If available.
- ref: server.socket.address
tag: connection-level
- ref: server.socket.port
tag: connection-level
- ref: network.transport
tag: connection-level
- ref: network.type
tag: connection-level
- ref: server.socket.domain
tag: connection-level
requirement_level:
recommended: If different than `server.address` and if `server.socket.address` is set.
- ref: network.protocol.name
examples: ['amqp', 'mqtt']
- ref: network.protocol.version
- id: messaging.rabbitmq
prefix: messaging.rabbitmq
type: attribute_group
extends: messaging
brief: >
Attributes for RabbitMQ
attributes:
- id: destination.routing_key
type: string
requirement_level:
conditionally_required: If not empty.
brief: >
RabbitMQ message routing key.
examples: 'myKey'
- id: messaging.kafka
prefix: messaging.kafka
type: attribute_group
extends: messaging
brief: >
Attributes for Apache Kafka
attributes:
- id: message.key
type: string
brief: >
Message 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.
note: >
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.
examples: 'myKey'
- id: consumer.group
type: string
brief: >
Name of the Kafka Consumer Group that is handling the message.
Only applies to consumers, not producers.
examples: 'my-group'
- id: destination.partition
type: int
brief: >
Partition the message is sent to.
examples: 2
- id: message.offset
type: int
brief: >
The offset of a record in the corresponding Kafka partition.
examples: 42
- id: message.tombstone
type: boolean
requirement_level:
conditionally_required: If value is `true`. When missing, the value is assumed to be `false`.
brief: 'A boolean that is true if the message is a tombstone.'
- id: messaging.rocketmq
prefix: messaging.rocketmq
type: attribute_group
extends: messaging
brief: >
Attributes for Apache RocketMQ
attributes:
- id: namespace
type: string
requirement_level: required
brief: >
Namespace of RocketMQ resources, resources in different namespaces are individual.
examples: 'myNamespace'
- id: client_group
type: string
requirement_level: required
brief: >
Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind.
examples: 'myConsumerGroup'
- id: message.delivery_timestamp
type: int
requirement_level:
conditionally_required: If the message type is delay and delay time level is not specified.
brief: >
The timestamp in milliseconds that the delay message is expected to be delivered to consumer.
examples: 1665987217045
- id: message.delay_time_level
type: int
requirement_level:
conditionally_required: If the message type is delay and delivery timestamp is not specified.
brief: >
The delay time level for delay message, which determines the message delay time.
examples: 3
- id: message.group
type: string
requirement_level:
conditionally_required: If the message type is FIFO.
brief: >
It is essential for FIFO message. Messages that belong to the same message group are always processed one by one within the same consumer group.
examples: 'myMessageGroup'
- id: message.type
type:
allow_custom_values: false
members:
- id: normal
value: 'normal'
brief: "Normal message"
- id: fifo
value: 'fifo'
brief: 'FIFO message'
- id: delay
value: 'delay'
brief: 'Delay message'
- id: transaction
value: 'transaction'
brief: 'Transaction message'
brief: >
Type of message.
- id: message.tag
type: string
brief: >
The secondary classifier of message besides topic.
examples: tagA
- id: message.keys
type: string[]
brief: >
Key(s) of message, another way to mark message besides message id.
examples: ['keyA', 'keyB']
- id: consumption_model
type:
allow_custom_values: false
members:
- id: clustering
value: 'clustering'
brief: 'Clustering consumption model'
- id: broadcasting
value: 'broadcasting'
brief: 'Broadcasting consumption model'
brief: >
Model of message consumption. This only applies to consumer spans.