Skip to content

Commit

Permalink
Add specific attributes for Apache RocketMQ
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-ai committed Oct 13, 2021
1 parent 1faf986 commit 2e3684f
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ release.
([#1973](https://github.com/open-telemetry/opentelemetry-specification/pull/1973))
- Add Tencent Cloud as a cloud provider.
([#2006](https://github.com/open-telemetry/opentelemetry-specification/pull/2006))

- Don't set Span.Status for 4xx http status codes for SERVER spans.
([#1998](https://github.com/open-telemetry/opentelemetry-specification/pull/1998))
- Add attributes for Apache RocketMQ.
([#1904](https://github.com/open-telemetry/opentelemetry-specification/pull/1904))

### Compatibility

Expand Down
67 changes: 66 additions & 1 deletion semantic_conventions/trace/messaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ groups:
type: string
required: always
brief: 'A string identifying the messaging system.'
examples: ['kafka', 'rabbitmq', 'activemq', 'AmazonSQS']
examples: ['kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS']
- id: destination
type: string
required: always
Expand Down Expand Up @@ -180,3 +180,68 @@ groups:
required:
conditional: 'If missing, it is assumed to be false.'
brief: 'A boolean that is true if the message is a tombstone.'

- id: messaging.rocketmq
prefix: messaging.rocketmq
extends: messaging
brief: >
Attributes for Apache RocketMQ
attributes:
- id: namespace
type: string
required: always
brief: >
Namespace of RocketMQ resources, resources in different namespaces are individual.
examples: 'myNamespace'
- id: client_group
type: string
required: always
brief: >
Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind.
examples: 'myConsumerGroup'
- id: client_id
type: string
required: always
brief: >
The unique identifier for each client.
examples: 'myhost@8742@s8083jm'
- id: message_type
type:
allow_custom_values: false
members:
- id: normal
value: 'normal'
brief: "Normal message"
- id: fifo
value: 'fifo'
brief: 'FIFO message'
- id: delay
value: 'delay'
brief: 'Delay message'
- id: transaction
value: 'transaction'
brief: 'Transaction message'
brief: >
Type of message.
- id: message_tag
type: string
brief: >
The secondary classifier of message besides topic.
examples: tagA
- id: message_keys
type: string[]
brief: >
Key(s) of message, another way to mark message besides message id.
examples: ['keyA', 'keyB']
- id: consumption_model
type:
allow_custom_values: false
members:
- id: clustering
value: 'clustering'
brief: 'Clustering consumption model'
- id: broadcasting
value: 'broadcasting'
brief: 'Broadcasting consumption model'
brief: >
Model of message consumption. This only applies to consumer spans.
35 changes: 34 additions & 1 deletion specification/trace/semantic_conventions/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* [Attributes specific to certain messaging systems](#attributes-specific-to-certain-messaging-systems)
+ [RabbitMQ](#rabbitmq)
+ [Apache Kafka](#apache-kafka)
+ [Apache RocketMQ](#apache-rocketmq)
- [Examples](#examples)
* [Topic with multiple consumers](#topic-with-multiple-consumers)
* [Apache Kafka with Quarkus or Spring Boot Example](#apache-kafka-with-quarkus-or-spring-boot-example)
Expand Down Expand Up @@ -127,7 +128,7 @@ The following operations related to messages are defined for these semantic conv
<!-- semconv messaging -->
| Attribute | Type | Description | Examples | Required |
|---|---|---|---|---|
| `messaging.system` | string | A string identifying the messaging system. | `kafka`; `rabbitmq`; `activemq`; `AmazonSQS` | Yes |
| `messaging.system` | string | A string identifying the messaging system. | `kafka`; `rabbitmq`; `rocketmq`; `activemq`; `AmazonSQS` | Yes |
| `messaging.destination` | string | The message destination name. This might be equal to the span name but is required nevertheless. | `MyQueue`; `MyTopic` | Yes |
| `messaging.destination_kind` | string | The kind of message destination | `queue` | Conditional [1] |
| `messaging.temp_destination` | boolean | A boolean that is true if the message destination is temporary. | | If missing, it is assumed to be false. |
Expand Down Expand Up @@ -217,6 +218,38 @@ For Apache Kafka producers, [`peer.service`](./span-general.md#general-remote-se
The `service.name` of a Consumer's Resource SHOULD match the `peer.service` of the Producer, when the message is directly passed to another service.
If an intermediary broker is present, `service.name` and `peer.service` will not be the same.

#### Apache RocketMQ

Specific attributes for Apache RocketMQ are defined below.

<!-- semconv messaging.rocketmq -->
| Attribute | Type | Description | Examples | Required |
|---|---|---|---|---|
| `messaging.rocketmq.namespace` | string | Namespace of RocketMQ resources, resources in different namespaces are individual. | `myNamespace` | Yes |
| `messaging.rocketmq.client_group` | string | Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind. | `myConsumerGroup` | Yes |
| `messaging.rocketmq.client_id` | string | The unique identifier for each client. | `myhost@8742@s8083jm` | Yes |
| `messaging.rocketmq.message_type` | string | Type of message. | `normal` | No |
| `messaging.rocketmq.message_tag` | string | The secondary classifier of message besides topic. | `tagA` | No |
| `messaging.rocketmq.message_keys` | string[] | Key(s) of message, another way to mark message besides message id. | `[keyA, keyB]` | No |
| `messaging.rocketmq.consumption_model` | string | Model of message consumption. This only applies to consumer spans. | `clustering` | No |

`messaging.rocketmq.message_type` MUST be one of the following:

| Value | Description |
|---|---|
| `normal` | Normal message |
| `fifo` | FIFO message |
| `delay` | Delay message |
| `transaction` | Transaction message |

`messaging.rocketmq.consumption_model` MUST be one of the following:

| Value | Description |
|---|---|
| `clustering` | Clustering consumption model |
| `broadcasting` | Broadcasting consumption model |
<!-- endsemconv -->

## Examples

### Topic with multiple consumers
Expand Down

0 comments on commit 2e3684f

Please sign in to comment.