Skip to content

Commit

Permalink
add consumer namespace and describe what should be in destination/sou…
Browse files Browse the repository at this point in the history
…rce namespaces
  • Loading branch information
lmolkova committed Nov 22, 2022
1 parent 57ec5e8 commit d80d135
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ release.

- Rename `http.retry_count` to `http.resend_count` and clarify its meaning.
([#2743](https://github.com/open-telemetry/opentelemetry-specification/pull/2743))
- BREAKING: rename `messaging.destination` to `messaging.destination.name`,
- BREAKING: rename `messaging.consumer_id` to `messaging.consumer.id`,
`messaging.destination` to `messaging.destination.name`,
`messaging.temp_destination` to `messaging.destination.temporary`,
`messaging.destination_kind` to `messaging.destination.kind`,
`messaging.message_id` to `messaging.message.id`,
Expand All @@ -59,6 +60,7 @@ release.
`messaging.message_payload_compressed_size_bytes` to `messaging.message.payload_compressed_size_bytes`,
`messaging.rabbitmq.routing_key`: `messaging.rabbitmq.destination.routing_key`,
`messaging.kafka.message_key` to `messaging.kafka.message.key`,
`messaging.kafka.consumer_group` to `messaging.kafka.consumer.group`,
`messaging.kafka.partition` to `messaging.kafka.destination.partition`,
`messaging.kafka.tombstone` to `messaging.kafka.message.tombstone`,
`messaging.rocketmq.message_type` to `messaging.rocketmq.message.type`,
Expand Down
2 changes: 2 additions & 0 deletions schemas/1.16.0
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ versions:
changes:
- rename_attributes:
attribute_map:
messaging.consumer_id: messaging.consumer.id
messaging.protocol: net.app.protocol.name
messaging.protocol_version: net.app.protocol.version
messaging.destination: messaging.destination.name
Expand All @@ -23,6 +24,7 @@ versions:
messaging.rocketmq.message_type: messaging.rocketmq.message.type
messaging.rocketmq.message_tag: messaging.rocketmq.message.tag
messaging.rocketmq.message_keys: messaging.rocketmq.message.keys
messaging.kafka.consumer_group -> messaging.kafka.consumer.group
1.15.0:
spans:
changes:
Expand Down
8 changes: 4 additions & 4 deletions semantic_conventions/trace/messaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ groups:
span_kind: consumer
brief: 'Semantic convention for a consumer of messages received from a messaging system'
attributes:
- id: consumer_id
- id: consumer.id
type: string
brief: >
The identifier for the consumer receiving a message. For Kafka, set it to
`{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only
`messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id`
`{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only
`messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id`
of the client consuming the message.
examples: 'mygroup - client-6'
- ref: messaging.source.name
Expand Down Expand Up @@ -275,7 +275,7 @@ groups:
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
- id: consumer.group
type: string
brief: >
Name of the Kafka Consumer Group that is handling the message.
Expand Down
19 changes: 10 additions & 9 deletions specification/trace/semantic_conventions/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ These attributes should be set to the broker to which the message is sent/from w

Note that attributes in `messaging.message` namespace describe an individual message, `messaging.destination` namespace
contains attributes that describe the logical entity messages are published to, and `messaging.source` describes
logical entity messages are received from. Attributes in `messaging.batch` namespace describe batch properties.
logical entity messages are received from; attributes in `messaging.batch` namespace describe batch properties and `messaging.consumer` namespace
describes message consumer properties.

[network attributes]: span-general.md#general-network-connection-attributes
[`net.transport`]: span-general.md#network-transport-attributes
Expand Down Expand Up @@ -294,7 +295,7 @@ The following additional attributes describe message consumer operations.
<!-- semconv messaging.consumer -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `messaging.consumer_id` | string | The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. | `mygroup - client-6` | Recommended |
| `messaging.consumer.id` | string | The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. | `mygroup - client-6` | Recommended |
| `messaging.source.kind` | string | The kind of message source | `queue` | Conditionally Required: [1] |
| `messaging.source.template` | string | Low cardinality field representing messaging source [2] | `/customers/{customerId}` | Conditionally Required: [3] |
| `messaging.source.temporary` | boolean | A boolean that is true if the message source is temporary and might not exist anymore after messages are processed. | | Recommended: [4] |
Expand Down Expand Up @@ -353,12 +354,12 @@ set on links. Corresponding instrumentations MAY set source and destination attr

### Attributes specific to certain messaging systems

All attributes that are specific for a messaging system SHOULD be populated in `messaging.{system}` namespace. Attributes that are specific to the message, the message destination, the message source, or the whole batch SHOULD be populated under corresponding namespace:
All attributes that are specific for a messaging system SHOULD be populated in `messaging.{system}` namespace. Attributes that describe message, destination, source, consumer, or batch properties SHOULD be populated under corresponding namespace:

* message-specific under `messaging.{system}.message`
* destination-specific under `messaging.{system}.destination`
* source-specific under `messaging.{system}.source`
* batch-specific under `messaging.{system}.batch`
* `messaging.{system}.message` namespace describes individual messages
* `messaging.{system}.destination` namespace describes destination a message (or a batch) are published to, and `messaging.{system}.source` describes source messages were received from. Combination of attributes in these namespaces should uniquely identify the entity and describe it as precisely as possible. For example, if partitioning is supported, attributes should include partition or other important and visible to users entity properties.
* `messaging.{system}.consumer` namespace describes message consumer properties
* `messaging.{system}.batch` namespace describes message batch properties

#### RabbitMQ

Expand All @@ -379,7 +380,7 @@ For Apache Kafka, the following additional attributes are defined:
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `messaging.kafka.message.key` | string | 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. [1] | `myKey` | Recommended |
| `messaging.kafka.consumer_group` | string | Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. | `my-group` | Recommended |
| `messaging.kafka.consumer.group` | string | Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. | `my-group` | Recommended |
| `messaging.kafka.client_id` | string | Client Id for the Consumer or Producer that is handling the message. | `client-5` | Recommended |
| `messaging.kafka.destination.partition` | int | Partition the message is sent to. | `2` | Recommended |
| `messaging.kafka.source.partition` | int | Partition the message is received from. | `2` | Recommended |
Expand Down Expand Up @@ -500,7 +501,7 @@ Process CB: | Span Rcv2 |
| `messaging.source.kind` | | `"topic"` | `"topic"` | `"topic"` | `"topic"` |
| `messaging.operation` | | | `"process"` | | `"receive"` |
| `messaging.kafka.message.key` | `"myKey"` | `"myKey"` | `"myKey"` | `"anotherKey"` | `"anotherKey"` |
| `messaging.kafka.consumer_group` | | `"my-group"` | `"my-group"` | | `"another-group"` |
| `messaging.kafka.consumer.group` | | `"my-group"` | `"my-group"` | | `"another-group"` |
| `messaging.kafka.client_id` | | `"5"` | `"5"` | `"5"` | `"8"` |
| `messaging.kafka.partition` | | `"1"` | `"1"` | | `"3"` |

Expand Down

0 comments on commit d80d135

Please sign in to comment.