Skip to content

Commit

Permalink
Add guidance on yaml file
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopgrassi committed Dec 13, 2024
1 parent c87df8f commit f48427f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
36 changes: 12 additions & 24 deletions docs/messaging/rabbitmq.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,6 @@ The Semantic Conventions for [RabbitMQ](https://www.rabbitmq.com/) extend and ov

## RabbitMQ attributes

### Destination name

In RabbitMQ, the destination is defined by an *exchange*, a *routing key* and
for consumers, a *queue*.

`messaging.destination.name` SHOULD be set to:

#### Producers

- `{exchange}:{routing key}` when both values are present and non-empty.
If any has an empty value (e.g., the default exchange is used) it SHOULD be omitted.
- Otherwise: `amq.default` when the default exchange is used and no routing key is provided

#### Consumers

- `{exchange}:{routing key}:{queue}` when all values are present and non-empty.
If any has an empty value (e.g., the default exchange is used) it SHOULD be omitted.

For cases when `{routing key}` and `{queue}` are equal, only one of them SHOULD
be used, e.g., `{exchange}:{routing key}`.

<!-- semconv messaging.rabbitmq -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
Expand All @@ -72,7 +51,7 @@ be used, e.g., `{exchange}:{routing key}`.
|---|---|---|---|---|---|
| [`messaging.operation.name`](/docs/attributes-registry/messaging.md) | string | The system-specific name of the messaging operation. | `ack`; `nack`; `send` | `Required` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [1] | `amqp:decode-error`; `KAFKA_STORAGE_ERROR`; `channel-error` | `Conditionally Required` If and only if the messaging operation has failed. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`messaging.destination.name`](/docs/attributes-registry/messaging.md) | string | The message destination name [2] | `MyQueue`; `MyTopic` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`messaging.destination.name`](/docs/attributes-registry/messaging.md) | string | The message destination name [2] | `direct_logs:warning`; `logs` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`messaging.operation.type`](/docs/attributes-registry/messaging.md) | string | A string identifying the type of the messaging operation. [4] | `create`; `send`; `receive` | `Conditionally Required` If applicable. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`messaging.rabbitmq.destination.routing_key`](/docs/attributes-registry/messaging.md) | string | RabbitMQ message routing key. | `myKey` | `Conditionally Required` If not empty. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`messaging.rabbitmq.message.delivery_tag`](/docs/attributes-registry/messaging.md) | int | RabbitMQ message delivery tag | `123` | `Conditionally Required` When available. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand Down Expand Up @@ -104,8 +83,17 @@ it's RECOMMENDED to:
- Use a domain-specific attribute
- Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.

**[2] `messaging.destination.name`:** Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker. If
the broker doesn't have such notion, the destination name SHOULD uniquely identify the broker.
**[2] `messaging.destination.name`:** In RabbitMQ, the destination is defined by an *exchange*, a *routing key* and for consumers, a *queue*.

`messaging.destination.name` SHOULD be set to:

- **Producers**: `{exchange}:{routing key}` when both values are present and non-empty.
Otherwise: `amq.default` when the default exchange is used and no routing key is provided

- **Consumers**: `{exchange}:{routing key}:{queue}` when all values are present and non-empty.
If any has an empty value (e.g., the default exchange is used) it SHOULD be omitted.
For cases when `{routing key}` and `{queue}` are equal, only one of them SHOULD
be used, e.g., `{exchange}:{routing key}`.

**[3] `messaging.destination.name`:** If span describes operation on a single message or if the value applies to all messages in the batch.

Expand Down
16 changes: 16 additions & 0 deletions model/messaging/spans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,22 @@ groups:
Message [correlation Id](https://www.rabbitmq.com/tutorials/tutorial-six-java#correlation-id) property.
- ref: messaging.message.body.size
requirement_level: opt_in
- ref: messaging.destination.name
note: |
In RabbitMQ, the destination is defined by an *exchange*, a *routing key* and for consumers, a *queue*.
`messaging.destination.name` SHOULD be set to:
- **Producers**: `{exchange}:{routing key}` when both values are present and non-empty.
Otherwise: `amq.default` when the default exchange is used and no routing key is provided
- **Consumers**: `{exchange}:{routing key}:{queue}` when all values are present and non-empty.
If any has an empty value (e.g., the default exchange is used) it SHOULD be omitted.
For cases when `{routing key}` and `{queue}` are equal, only one of them SHOULD
be used, e.g., `{exchange}:{routing key}`.
examples: ['direct_logs:warning', 'logs']
requirement_level:
conditionally_required: If span describes operation on a single message or if the value applies to all messages in the batch.

- id: messaging.kafka
type: attribute_group
Expand Down

0 comments on commit f48427f

Please sign in to comment.