diff --git a/CHANGELOG.md b/CHANGELOG.md index 297a3477160..ed45dc8cc32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ release. - Adding alibaba cloud as a cloud provider. ([#1831](https://github.com/open-telemetry/opentelemetry-specification/pull/1831)) +- Add `messaging.consumer_id` to differentiate between message consumers. + ([#1810](https://github.com/open-telemetry/opentelemetry-specification/pull/1810)) ### Compatibility diff --git a/semantic_conventions/trace/messaging.yaml b/semantic_conventions/trace/messaging.yaml index 6a9630bafdd..03c8baeb176 100644 --- a/semantic_conventions/trace/messaging.yaml +++ b/semantic_conventions/trace/messaging.yaml @@ -112,6 +112,14 @@ groups: [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. + - 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` + of the client consuming the message. + examples: 'mygroup - client-6' - id: messaging.consumer.synchronous prefix: messaging diff --git a/specification/trace/semantic_conventions/messaging.md b/specification/trace/semantic_conventions/messaging.md index 0bfd5d07af5..e35efd0a03f 100644 --- a/specification/trace/semantic_conventions/messaging.md +++ b/specification/trace/semantic_conventions/messaging.md @@ -167,6 +167,7 @@ For message consumers, the following additional attributes may be set: | Attribute | Type | Description | Examples | Required | |---|---|---|---|---| | `messaging.operation` | string | A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. | `receive` | No | +| `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` | No | `messaging.operation` MUST be one of the following: