semantic-conventions/semantic_conventions/trace/messaging.yaml

373 lines
15 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
- ref: messaging.source.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.payload_size_bytes
type: int
brief: >
The (uncompressed) size of the message payload in bytes.
Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported.
examples: 2738
- id: message.payload_compressed_size_bytes
type: int
brief: 'The compressed size of the message payload in bytes.'
examples: 2048
- id: messaging.destination
prefix: messaging.destination
type: attribute_group
brief: 'Semantic convention for attributes that describe messaging destination on broker'
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.source
prefix: messaging.source
type: attribute_group
brief: 'Semantic convention for attributes that describe messaging source on broker'
attributes:
- id: name
type: string
brief: 'The message source name'
note: |
Source name SHOULD uniquely identify a specific queue, topic, or other entity within the broker. If
the broker does not have such notion, the source name SHOULD uniquely identify the broker.
examples: ['MyQueue', 'MyTopic']
- id: template
type: string
brief: 'Low cardinality representation of the messaging source name'
examples: ['/customers/{customerId}']
note: >
Source names could be constructed from templates.
An example would be a source name involving a user name or product id.
Although the source name in this case is of high cardinality,
the underlying template is of low cardinality and can be effectively
used for grouping and aggregation.
- id: temporary
type: boolean
brief: 'A boolean that is true if the message source is temporary and might not exist anymore after messages are processed.'
- id: anonymous
type: boolean
brief: 'A boolean that is true if the message source 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.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.payload_size_bytes
requirement_level:
recommended: Only if span represents operation on a single message.
- ref: messaging.message.payload_compressed_size_bytes
requirement_level:
recommended: Only if span represents operation on a single message.
- ref: net.peer.name
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: net.sock.peer.addr
tag: connection-level
- ref: net.sock.peer.port
tag: connection-level
- ref: net.sock.family
tag: connection-level
- ref: net.sock.peer.name
tag: connection-level
requirement_level:
recommended: If different than `net.peer.name` and if `net.sock.peer.addr` is set.
- ref: net.protocol.name
examples: ['amqp', 'mqtt']
- ref: net.protocol.version
- id: messaging.producer
prefix: messaging
type: span
extends: messaging
span_kind: producer
brief: 'Semantic convention for producers of messages sent to a messaging systems.'
attributes:
- ref: messaging.destination.name
requirement_level:
conditionally_required: If one message is being published 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`.
- id: messaging.producer.synchronous
prefix: messaging
type: span
extends: messaging
span_kind: client
brief: >
Semantic convention for clients of messaging systems that produce messages
and synchronously wait for responses.
- id: messaging.consumer
prefix: messaging
type: span
extends: messaging
span_kind: consumer
brief: 'Semantic convention for a consumer of messages received from a messaging system'
attributes:
- ref: messaging.source.name
requirement_level:
conditionally_required: If the value applies to all messages in the batch.
- ref: messaging.source.template
requirement_level:
conditionally_required: >
If available. Instrumentations MUST NOT use `messaging.source.name` as template
unless low-cardinality of source name is guaranteed.
- ref: messaging.source.temporary
requirement_level:
recommended: When supported by messaging system and only if the source is temporary. When missing, the value is assumed to be `false`.
- ref: messaging.source.anonymous
requirement_level:
recommended: When supported by messaging system and only if the source is anonymous. When missing, the value is assumed to be `false`.
- ref: messaging.destination.name
requirement_level:
recommended: If known on consumer
- ref: messaging.destination.temporary
requirement_level:
recommended: If known on consumer
- ref: messaging.destination.anonymous
requirement_level:
recommended: If known on consumer
- id: messaging.consumer.synchronous
prefix: messaging
type: span
extends: messaging.consumer
span_kind: server
brief: >
Semantic convention for servers that consume messages received from messaging systems
and always send back replies directed to the producers of these messages.
- 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: source.partition
type: int
brief: >
Partition the message is received from.
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.