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

Define sampling relevant attributes for messaging client spans #1169

Merged
merged 6 commits into from
Jun 20, 2024
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
4 changes: 4 additions & 0 deletions .chloggen/1169.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
change_type: enhancement
component: messaging
note: Define sampling relevant attributes for messaging client spans
issues: [ 432, 1169 ]
25 changes: 23 additions & 2 deletions docs/messaging/azure-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Semantic Conventions for [Azure Service Bus](https://learn.microsoft.com/azu

## Azure Service Bus

`messaging.system` MUST be set to `"servicebus"`.
`messaging.system` MUST be set to `"servicebus"` and SHOULD be provided **at span creation time**.

### Span attributes

Expand Down Expand Up @@ -88,6 +88,16 @@ the broker doesn't have such notion, the destination name SHOULD uniquely identi



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`messaging.destination.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.subscription.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.type`](/docs/attributes-registry/messaging.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down Expand Up @@ -124,7 +134,7 @@ the broker doesn't have such notion, the destination name SHOULD uniquely identi

## Azure Event Hubs

`messaging.system` MUST be set to `"eventhubs"`.
`messaging.system` MUST be set to `"eventhubs"` and SHOULD be provided **at span creation time**.

### Span attributes

Expand Down Expand Up @@ -199,6 +209,17 @@ the broker doesn't have such notion, the destination name SHOULD uniquely identi



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`messaging.consumer.group.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.partition.id`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.type`](/docs/attributes-registry/messaging.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
12 changes: 11 additions & 1 deletion docs/messaging/gcp-pubsub.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ linkTitle: Google Cloud Pub/Sub

The Semantic Conventions for [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) extend and override the [Messaging Semantic Conventions](README.md) that describe common messaging operations attributes in addition to the Semantic Conventions described on this page.

`messaging.system` MUST be set to `"gcp_pubsub"`.
`messaging.system` MUST be set to `"gcp_pubsub"` and SHOULD be provided **at span creation time**.

## Span attributes

Expand Down Expand Up @@ -83,6 +83,16 @@ the broker doesn't have such notion, the destination name SHOULD uniquely identi



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`messaging.destination.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.subscription.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.type`](/docs/attributes-registry/messaging.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
13 changes: 12 additions & 1 deletion docs/messaging/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The Semantic Conventions for [Apache Kafka](https://kafka.apache.org/) extend an
that describe common messaging operations attributes in addition to the Semantic Conventions
described on this page.

`messaging.system` MUST be set to `"kafka"`.
`messaging.system` MUST be set to `"kafka"` and SHOULD be provided **at span creation time**.

## Span attributes

Expand Down Expand Up @@ -93,6 +93,17 @@ body size should be used.



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`messaging.consumer.group.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.partition.id`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.type`](/docs/attributes-registry/messaging.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
19 changes: 19 additions & 0 deletions docs/messaging/messaging-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,20 @@ If a messaging operation involved multiple network calls (for example retries),



The following attributes can be important for making sampling decisions
pyohannes marked this conversation as resolved.
Show resolved Hide resolved
and SHOULD be provided **at span creation time** (if provided at all):

* [`messaging.consumer.group.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.partition.id`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.subscription.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.template`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.type`](/docs/attributes-registry/messaging.md)
* [`messaging.system`](/docs/attributes-registry/messaging.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down Expand Up @@ -455,6 +469,11 @@ the broker doesn't have such notion, the original destination name SHOULD unique



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`messaging.destination_publish.name`](/docs/attributes-registry/messaging.md)


<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
Expand Down
11 changes: 10 additions & 1 deletion docs/messaging/rabbitmq.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Semantic Conventions for [RabbitMQ](https://www.rabbitmq.com/) extend and ov
that describe common messaging operations attributes in addition to the Semantic Conventions
described on this page.

`messaging.system` MUST be set to `"rabbitmq"`.
`messaging.system` MUST be set to `"rabbitmq"` and SHOULD be provided **at span creation time**.

## RabbitMQ attributes

Expand Down Expand Up @@ -78,6 +78,15 @@ body size should be used.



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`messaging.destination.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.type`](/docs/attributes-registry/messaging.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
12 changes: 11 additions & 1 deletion docs/messaging/rocketmq.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Semantic Conventions for [Apache RocketMQ](https://rocketmq.apache.org/) ext
that describe common messaging operations attributes in addition to the Semantic Conventions
described on this page.

`messaging.system` MUST be set to `"rocketmq"`.
`messaging.system` MUST be set to `"rocketmq"` and SHOULD be provided **at span creation time**.

## Apache RocketMQ attributes

Expand Down Expand Up @@ -89,6 +89,16 @@ body size should be used.



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`messaging.consumer.group.name`](/docs/attributes-registry/messaging.md)
* [`messaging.destination.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.name`](/docs/attributes-registry/messaging.md)
* [`messaging.operation.type`](/docs/attributes-registry/messaging.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
23 changes: 23 additions & 0 deletions model/trace/messaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
In other cases, destination attributes may be set on links.
attributes:
- ref: messaging.destination_publish.name
sampling_relevant: true
- ref: messaging.destination_publish.anonymous

- id: attributes.messaging.trace.minimal
Expand All @@ -27,15 +28,25 @@
attributes:
- ref: messaging.operation.name
requirement_level: required
sampling_relevant: true
- ref: messaging.operation.type
requirement_level:
conditionally_required: If applicable.
sampling_relevant: true
- ref: messaging.destination.name
requirement_level:
conditionally_required: If span describes operation on a single message or if the value applies to all messages in the batch.
sampling_relevant: true
- ref: messaging.message.id
requirement_level:
recommended: If span describes operation on a single message.
- ref: server.address
sampling_relevant: true
- ref: server.port
sampling_relevant: true
# TODO: add messaging.system once https://github.com/open-telemetry/build-tools/issues/192 is implemented

Check warning on line 47 in model/trace/messaging.yaml

View workflow job for this annotation

GitHub Actions / yamllint

[comments-indentation] comment not indented like content
# - ref: messaging.system
# sampling_relevant: true

- id: messaging
type: span
Expand All @@ -45,16 +56,19 @@
attributes:
- ref: messaging.system
requirement_level: required
sampling_relevant: true
- ref: messaging.client.id
requirement_level: recommended
- ref: messaging.destination.partition.id
requirement_level:
recommended: When applicable.
sampling_relevant: true
- ref: messaging.destination.template
requirement_level:
conditionally_required: >
If available. Instrumentations MUST NOT use `messaging.destination.name` as template
unless low-cardinality of destination name is guaranteed.
sampling_relevant: true
- ref: messaging.destination.temporary
requirement_level:
conditionally_required: If value is `true`. When missing, the value is assumed to be `false`.
Expand All @@ -64,9 +78,11 @@
- ref: messaging.consumer.group.name
requirement_level:
conditionally_required: If applicable.
sampling_relevant: true
- ref: messaging.destination.subscription.name
requirement_level:
conditionally_required: If applicable.
sampling_relevant: true
- ref: messaging.message.conversation_id
- ref: messaging.message.envelope.size
- ref: messaging.message.body.size
Expand Down Expand Up @@ -126,10 +142,12 @@
- ref: messaging.consumer.group.name
brief: "Kafka [consumer group id](https://docs.confluent.io/platform/current/clients/consumer.html)."
note: ""
sampling_relevant: true
- ref: messaging.destination.partition.id
brief: >
String representation of the partition id the message (or batch) is sent to or received from.
requirement_level: recommended
sampling_relevant: true
- ref: messaging.kafka.message.key
requirement_level:
recommended: If span describes operation on a single message.
Expand All @@ -156,6 +174,7 @@
- ref: messaging.consumer.group.name
brief: "RocketMQ [consumer group name](https://rocketmq.apache.org/docs/domainModel/07consumergroup)."
note: ""
sampling_relevant: true
requirement_level: required
- ref: messaging.rocketmq.namespace
requirement_level: required
Expand Down Expand Up @@ -188,6 +207,7 @@
- ref: messaging.destination.subscription.name
brief: "Google Pub/Sub [subscription name](https://cloud.google.com/pubsub/docs/subscription-overview)."
note: ""
sampling_relevant: true
- ref: messaging.gcp_pubsub.message.ordering_key
requirement_level:
conditionally_required: If the message type has an ordering key set.
Expand Down Expand Up @@ -216,6 +236,7 @@
- ref: messaging.destination.subscription.name
brief: "Azure Service Bus [subscription name](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-queues-topics-subscriptions#topics-and-subscriptions)."
note: ""
sampling_relevant: true
requirement_level:
conditionally_required: If messages are received from the subscription.
- ref: messaging.servicebus.message.delivery_count
Expand Down Expand Up @@ -257,11 +278,13 @@
note: ""
requirement_level:
conditionally_required: On consumer spans.
sampling_relevant: true
- ref: messaging.destination.partition.id
brief: >
String representation of the partition id messages are sent to or received from, unique within the Event Hub.
requirement_level:
conditionally_required: If available.
sampling_relevant: true
- ref: messaging.eventhubs.message.enqueued_time
- ref: messaging.batch.message_count
requirement_level:
Expand Down
Loading