diff --git a/CHANGELOG.md b/CHANGELOG.md index 06a9acd224e..3f6fdffff32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ release. - Rename `rpc.request.metadata.` and `rpc.response.metadata.` to `rpc.grpc.request.metadata.` and `rpc.grpc.response.metadata.` ([#2981](https://github.com/open-telemetry/opentelemetry-specification/pull/2981)) +- Add `messaging.kafka.message.offset` attribute. + ([#2982](https://github.com/open-telemetry/opentelemetry-specification/pull/2982)) ### Compatibility diff --git a/semantic_conventions/trace/messaging.yaml b/semantic_conventions/trace/messaging.yaml index f50844a8a95..ff917a05091 100644 --- a/semantic_conventions/trace/messaging.yaml +++ b/semantic_conventions/trace/messaging.yaml @@ -189,6 +189,11 @@ groups: brief: > Partition the message is sent to. examples: 2 + - id: message.offset + type: int + brief: > + The offset of a record in the corresponding Kafka partition. + examples: 42 - id: tombstone type: boolean requirement_level: diff --git a/specification/trace/semantic_conventions/messaging.md b/specification/trace/semantic_conventions/messaging.md index c11b4fd5c6e..faecbe03658 100644 --- a/specification/trace/semantic_conventions/messaging.md +++ b/specification/trace/semantic_conventions/messaging.md @@ -280,6 +280,7 @@ For Apache Kafka, the following additional attributes are defined: | `messaging.kafka.consumer_group` | string | Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. | `my-group` | Recommended | | `messaging.kafka.client_id` | string | Client Id for the Consumer or Producer that is handling the message. | `client-5` | Recommended | | `messaging.kafka.partition` | int | Partition the message is sent to. | `2` | Recommended | +| `messaging.kafka.message.offset` | int | The offset of a record in the corresponding Kafka partition. | `42` | Recommended | | `messaging.kafka.tombstone` | boolean | A boolean that is true if the message is a tombstone. | | Conditionally Required: [2] | **[1]:** If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. @@ -395,7 +396,8 @@ Process CB: | Span Rcv2 | | `messaging.kafka.message_key` | `"myKey"` | `"myKey"` | `"myKey"` | `"anotherKey"` | `"anotherKey"` | | `messaging.kafka.consumer_group` | | `"my-group"` | `"my-group"` | | `"another-group"` | | `messaging.kafka.client_id` | | `"5"` | `"5"` | `"5"` | `"8"` | -| `messaging.kafka.partition` | | `"1"` | `"1"` | | `"3"` | +| `messaging.kafka.partition` | `"1"` | `"1"` | `"1"` | `"3"` | `"3"` | +| `messaging.kafka.message.offset` | `"12"` | `"12"` | `"12"` | `"32"` | `"32"` | ### Batch receiving