From 60ee36fc2f897d6a7256ca3e00eacb0a00c61dc1 Mon Sep 17 00:00:00 2001 From: Ken Finnigan Date: Fri, 9 Jul 2021 13:54:39 -0400 Subject: [PATCH] Add `consumer_id` to identify the consumer Resolves #1796 --- CHANGELOG.md | 2 ++ semantic_conventions/trace/messaging.yaml | 8 ++++++++ specification/trace/semantic_conventions/messaging.md | 1 + 3 files changed, 11 insertions(+) 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: