groups:
  - id: registry.messaging
    type: attribute_group
    stability: experimental
    display_name: General Messaging Attributes
    brief: 'Attributes describing telemetry around messaging systems and messaging activities.'
    attributes:
      - id: messaging.batch.message_count
        type: int
        stability: experimental
        brief: The number of messages sent, received, or processed in the scope of the batching operation.
        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: messaging.client.id
        type: string
        stability: experimental
        brief: >
          A unique identifier for the client that consumes or produces a message.
        examples: ['client-5', 'myhost@8742@s8083jm']
      - id: messaging.consumer.group.name
        type: string
        stability: experimental
        brief: >
          The name of the consumer group with which a consumer is associated.
        note: >
          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.
        examples: ['my-group', 'indexer']
      - id: messaging.destination.name
        type: string
        stability: experimental
        brief: 'The message destination name'
        note: |
          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.
        examples: ['MyQueue', 'MyTopic']
      - id: messaging.destination.subscription.name
        type: string
        stability: experimental
        brief: 'The name of the destination subscription from which a message is consumed.'
        note: >
          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.
        examples: ['subscription-a']
      - id: messaging.destination.template
        type: string
        stability: experimental
        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: messaging.destination.anonymous
        type: boolean
        stability: experimental
        brief: 'A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name).'
      - id: messaging.destination.temporary
        type: boolean
        stability: experimental
        brief: 'A boolean that is true if the message destination is temporary and might not exist anymore after messages are processed.'
      - id: messaging.destination.partition.id
        type: string
        stability: experimental
        brief: >
          The identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.
        examples: '1'
      - id: messaging.message.conversation_id
        type: string
        stability: experimental
        brief: >
          The conversation ID identifying the conversation to which the message belongs,
          represented as a string. Sometimes called "Correlation ID".
        examples: 'MyConversationId'
      - id: messaging.message.envelope.size
        type: int
        stability: experimental
        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: messaging.message.id
        type: string
        stability: experimental
        brief: 'A value used by the messaging system as an identifier for the message, represented as a string.'
        examples: '452a7c7c7c7048c2f887f61572b18fc2'
      - id: messaging.message.body.size
        type: int
        stability: experimental
        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.operation.type
        type:
          members:
            - id: create
              value: "create"
              brief: >
                A 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.
              stability: experimental
            - id: send
              value: "send"
              brief: >
                One 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.
              stability: experimental
            - id: receive
              value: "receive"
              brief: >
                One 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.
              stability: experimental
            - id: process
              value: "process"
              brief: >
                One or more messages are processed by a consumer.
              stability: experimental
            - id: settle
              value: "settle"
              brief: >
                One or more messages are settled.
              stability: experimental
            - id: deliver
              value: "deliver"
              brief: "Deprecated. Use `process` instead."
              deprecated: "Replaced by `process`."
              stability: experimental
            - id: publish
              value: "publish"
              brief: "Deprecated. Use `send` instead."
              deprecated: "Replaced by `send`."
              stability: experimental

        stability: experimental
        brief: >
          A string identifying the type of the messaging operation.
        note: If a custom value is used, it MUST be of low cardinality.
      - id: messaging.operation.name
        type: string
        stability: experimental
        brief: >
          The system-specific name of the messaging operation.
        examples: [ "ack", "nack", "send" ]
      - id: messaging.system
        brief: The messaging system as identified by the client instrumentation.
        note: >
          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.
        type:
          members:
            - id: activemq
              value: 'activemq'
              brief: 'Apache ActiveMQ'
              stability: experimental
            - id: aws_sqs
              value: 'aws_sqs'
              brief: 'Amazon Simple Queue Service (SQS)'
              stability: experimental
            - id: eventgrid
              value: 'eventgrid'
              brief: 'Azure Event Grid'
              stability: experimental
            - id: eventhubs
              value: 'eventhubs'
              brief: 'Azure Event Hubs'
              stability: experimental
            - id: servicebus
              value: 'servicebus'
              brief: 'Azure Service Bus'
              stability: experimental
            - id: gcp_pubsub
              value: 'gcp_pubsub'
              brief: 'Google Cloud Pub/Sub'
              stability: experimental
            - id: jms
              value: 'jms'
              brief: 'Java Message Service'
              stability: experimental
            - id: kafka
              value: 'kafka'
              brief: 'Apache Kafka'
              stability: experimental
            - id: rabbitmq
              value: 'rabbitmq'
              brief: 'RabbitMQ'
              stability: experimental
            - id: rocketmq
              value: 'rocketmq'
              brief: 'Apache RocketMQ'
              stability: experimental
            - id: pulsar
              value: 'pulsar'
              brief: 'Apache Pulsar'
              stability: experimental
        stability: experimental
  - id: registry.messaging.kafka
    type: attribute_group
    display_name: Kafka Attributes
    brief: >
      This group describes attributes specific to Apache Kafka.
    attributes:
      - id: messaging.kafka.message.key
        type: string
        stability: experimental
        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: messaging.kafka.offset
        type: int
        stability: experimental
        brief: >
          The offset of a record in the corresponding Kafka partition.
        examples: 42
      - id: messaging.kafka.message.tombstone
        type: boolean
        stability: experimental
        brief: 'A boolean that is true if the message is a tombstone.'
  - id: registry.messaging.rabbitmq
    type: attribute_group
    display_name: RabbitMQ Attributes
    brief: >
      This group describes attributes specific to RabbitMQ.
    attributes:
      - id: messaging.rabbitmq.destination.routing_key
        type: string
        stability: experimental
        brief: >
          RabbitMQ message routing key.
        examples: 'myKey'
      - id: messaging.rabbitmq.message.delivery_tag
        type: int
        stability: experimental
        brief: >
          RabbitMQ message delivery tag
        examples: 123
  - id: registry.messaging.rocketmq
    type: attribute_group
    display_name: RocketMQ Attributes
    brief: >
      This group describes attributes specific to RocketMQ.
    attributes:
      - id: messaging.rocketmq.consumption_model
        type:
          members:
            - id: clustering
              value: 'clustering'
              brief: 'Clustering consumption model'
              stability: experimental
            - id: broadcasting
              value: 'broadcasting'
              brief: 'Broadcasting consumption model'
              stability: experimental
        stability: experimental
        brief: >
          Model of message consumption. This only applies to consumer spans.
      - id: messaging.rocketmq.message.delay_time_level
        type: int
        stability: experimental
        brief: >
          The delay time level for delay message, which determines the message delay time.
        examples: 3
      - id: messaging.rocketmq.message.delivery_timestamp
        type: int
        stability: experimental
        brief: >
          The timestamp in milliseconds that the delay message is expected to be delivered to consumer.
        examples: 1665987217045
      - id: messaging.rocketmq.message.group
        type: string
        stability: experimental
        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: messaging.rocketmq.message.keys
        type: string[]
        stability: experimental
        brief: >
          Key(s) of message, another way to mark message besides message id.
        examples:
          - [keyA, keyB]
      - id: messaging.rocketmq.message.tag
        type: string
        stability: experimental
        brief: >
          The secondary classifier of message besides topic.
        examples: tagA
      - id: messaging.rocketmq.message.type
        type:
          members:
            - id: normal
              value: 'normal'
              brief: "Normal message"
              stability: experimental
            - id: fifo
              value: 'fifo'
              brief: 'FIFO message'
              stability: experimental
            - id: delay
              value: 'delay'
              brief: 'Delay message'
              stability: experimental
            - id: transaction
              value: 'transaction'
              brief: 'Transaction message'
              stability: experimental
        stability: experimental
        brief: >
          Type of message.
      - id: messaging.rocketmq.namespace
        type: string
        stability: experimental
        brief: >
          Namespace of RocketMQ resources, resources in different namespaces are individual.
        examples: 'myNamespace'
  - id: registry.messaging.gcp_pubsub
    type: attribute_group
    display_name: GCP Pub/Sub Attributes
    brief: >
      This group describes attributes specific to GCP Pub/Sub.
    attributes:
      - id: messaging.gcp_pubsub.message.ordering_key
        type: string
        stability: experimental
        brief: >
          The ordering key for a given message. If the attribute is not present, the message does not have an ordering key.
        examples: 'ordering_key'
      - id: messaging.gcp_pubsub.message.ack_id
        type: string
        stability: experimental
        brief: >
         The ack id for a given message.
        examples: 'ack_id'
      - id: messaging.gcp_pubsub.message.ack_deadline
        type: int
        stability: experimental
        brief: >
          The ack deadline in seconds set for the modify ack deadline request.
        examples: 10
      - id: messaging.gcp_pubsub.message.delivery_attempt
        type: int
        stability: experimental
        brief: >
          The delivery attempt for a given message.
        examples: 2
  - id: registry.messaging.servicebus
    type: attribute_group
    display_name: Azure Service Bus Attributes
    brief: >
      This group describes attributes specific to Azure Service Bus.
    attributes:
      - id: messaging.servicebus.message.delivery_count
        type: int
        stability: experimental
        brief: >
          Number of deliveries that have been attempted for this message.
        examples: 2
      - id: messaging.servicebus.message.enqueued_time
        type: int
        stability: experimental
        brief: >
          The UTC epoch seconds at which the message has been accepted and stored in the entity.
        examples: 1701393730
      - id: messaging.servicebus.disposition_status
        brief: >
          Describes the [settlement type](https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock).
        type:
          members:
            - id: complete
              value: 'complete'
              brief: 'Message is completed'
              stability: experimental
            - id: abandon
              value: 'abandon'
              brief: 'Message is abandoned'
              stability: experimental
            - id: dead_letter
              value: 'dead_letter'
              brief: 'Message is sent to dead letter queue'
              stability: experimental
            - id: defer
              value: 'defer'
              brief: 'Message is deferred'
              stability: experimental
        stability: experimental
  - id: registry.messaging.eventhubs
    type: attribute_group
    display_name: Azure Event Hubs Attributes
    brief: >
      This group describes attributes specific to Azure Event Hubs.
    attributes:
      - id: messaging.eventhubs.message.enqueued_time
        type: int
        stability: experimental
        brief: >
          The UTC epoch seconds at which the message has been accepted and stored in the entity.
        examples: 1701393730
