Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add consumer_id to identify the consumer #1810

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ release.
- Add mobile-related network state: `net.host.connection.type`, `net.host.connection.subtype` & `net.host.carrier.*` [#1647](https://github.com/open-telemetry/opentelemetry-specification/issues/1647)
- 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

Expand Down
8 changes: 8 additions & 0 deletions semantic_conventions/trace/messaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I'm not sure about in this PR is this format. Isn't there some standard "fully qualified client ID" format for Kafka?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so, as https://jaceklaskowski.gitbooks.io/apache-kafka/content/kafka-properties-client-id.html describes how it's an optional identifier passed to the broker, so it could be anything

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the combined format, where we now put " - " in-between. I wondered if there is some existing notation to combine consumer group and client_id into a single identifier string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I've found unfortunately

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are client_ids unique across consumer groups? Maybe it would be better then to just use the client_id here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They must be unique within a Kafka Broker, but they're not required. It's possible for a consumer to only have the consumer group id set and not the client id.

`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
Expand Down
1 change: 1 addition & 0 deletions specification/trace/semantic_conventions/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down