diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d32dc3621..7ce5610d1f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ release. ([#2502](https://github.com/open-telemetry/opentelemetry-specification/pull/2502)) - Define attribute requirement levels ([#2522](https://github.com/open-telemetry/opentelemetry-specification/pull/2522)) +- Add semantic conventions for Kafka consumer metrics + ([#2536](https://github.com/open-telemetry/opentelemetry-specification/pull/2536)) ### Compatibility diff --git a/specification/metrics/semantic_conventions/instrumentation/kafka.md b/specification/metrics/semantic_conventions/instrumentation/kafka.md index bd5cfd06864..5474de1f80e 100644 --- a/specification/metrics/semantic_conventions/instrumentation/kafka.md +++ b/specification/metrics/semantic_conventions/instrumentation/kafka.md @@ -8,6 +8,7 @@ This document defines how to apply semantic conventions when instrumenting Kafka - [Kafka Metrics](#kafka-metrics) - [Kafka Producer Metrics](#kafka-producer-metrics) +- [Kafka Consumer Metrics](#kafka-consumer-metrics) @@ -30,6 +31,16 @@ This document defines how to apply semantic conventions when instrumenting Kafka | messaging.kafka.controllers.active | UpDownCounter | Int64 | controllers | `{controllers}` | The number of active controllers in the broker. | | | | messaging.kafka.leader.elections | Counter | Int64 | elections | `{elections}` | Leader election rate (increasing values indicates broker failures). | | | | messaging.kafka.leader.unclean-elections | Counter | Int64 | elections | `{elections}` | Unclean leader election rate (increasing values indicates broker failures). | | | +| messaging.kafka.brokers | UpDownCounter | Int64 | brokers | `{brokers}` | Number of brokers in the cluster. | | | +| messaging.kafka.topic.partitions | UpDownCounter | Int64 | partitions | `{partitions}` | Number of partitions in topic. | `topic` | The ID (integer) of a topic | +| messaging.kafka.partition.current_offset | Gauge | Int64 | partition offset | `{partition offset}` | Current offset of partition of topic. | `topic` | The ID (integer) of a topic | +| | | | | | | `partition` | The number (integer) of the partition | +| messaging.kafka.partition.oldest_offset | Gauge | Int64 | partition offset | `{partition offset}` | Oldest offset of partition of topic | `topic` | The ID (integer) of a topic | +| | | | | | | `partition` | The number (integer) of the partition | +| messaging.kafka.partition.replicas.all | UpDownCounter | Int64 | replicas | `{replicas}` | Number of replicas for partition of topic | `topic` | The ID (integer) of a topic | +| | | | | | | `partition` | The number (integer) of the partition | +| messaging.kafka.partition.replicas.in_sync | UpDownCounter | Int64 | replicas | `{replicas}` | Number of synchronized replicas of partition | `topic` | The ID (integer) of a topic | +| | | | | | | `partition` | The number (integer) of the partition| ## Kafka Producer Metrics @@ -49,3 +60,21 @@ This document defines how to apply semantic conventions when instrumenting Kafka | | | | | | | `topic` | topic name | | messaging.kafka.producer.record-sent.rate | Gauge | Double | records sent rate | `{records_sent}/s` | The average number of records sent per second for a specific topic. | `client-id` | `client-id` value | | | | | | | | `topic` | topic name | + +## Kafka Consumer Metrics + +**Description:** Kafka Consumer level metrics. + +| Name | Instrument | Value type | Unit | Unit ([UCUM](../README.md#instrument-units)) | Description | Attribute Key | Attribute Values | +| --------------------------------------------- | ------------- | ---------- | ------ | -------------------------------------------- | -------------- | ------------- | ---------------- | +| messaging.kafka.consumer.members | UpDownCounter | Int64 | members | `{members}` | Count of members in the consumer group | `group` | The ID (string) of a consumer group | +| messaging.kafka.consumer.offset | Gauge | Int64 | offset | `{offset}` | Current offset of the consumer group at partition of topic | `group` | The ID (string) of a consumer group | +| | | | | | | `topic` | The ID (integer) of a topic | +| | | | | | | `partition` | The number (integer) of the partition | +| messaging.kafka.consumer.offset_sum | Gauge | Int64 | offset sum | `{offset sum}` | Sum of consumer group offset across partitions of topic | `group` | The ID (string) of a consumer group | +| | | | | | | `topic` | The ID (integer) of a topic | +| messaging.kafka.consumer.lag | Gauge | Int64 | lag | `{lag}` | Current approximate lag of consumer group at partition of topic | `group` | The ID (string) of a consumer group | +| | | | | | | `topic` | The ID (integer) of a topic | +| | | | | | | `partition` | The number (integer) of the partition | +| messaging.kafka.consumer.lag_sum | Gauge | Int64 | lag sum | `{lag sum}` | Current approximate sum of consumer group lag across all partitions of topic | `group` | The ID (string) of a consumer group | +| | | | | | | `topic` | The ID (integer) of a topic |