Skip to content

Commit dc1ccbb

Browse files
ZenoCC-PengCaleb-Hurshman
authored andcommitted
[receiver/kafkametrics] Fix metrics in kafkametricsreceiver (#4327) (open-telemetry#23632)
Utilize mdatagen to modify certain metrics from gauge to non-monotonic sum, employing delta aggregation. Adjust the test files to align with the sum test type and update the expected.yaml file for integration testing purposes. Co-authored-by: zeno-splunk <[email protected]>
1 parent 380d295 commit dc1ccbb

File tree

7 files changed

+106
-63
lines changed

7 files changed

+106
-63
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use this changelog template to create an entry for release notes.
2+
# If your change doesn't affect end users, such as a test fix or a tooling change,
3+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
4+
5+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
6+
change_type: bug_fix
7+
8+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
9+
component: receiver/kafkametricsreceiver
10+
11+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
12+
note: Updates certain metrics in kafkametricsreceiver to function as non-monotonic sums.
13+
14+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
15+
issues: [4327]
16+
17+
# (Optional) One or more lines of additional information to render under the primary note.
18+
# These lines will be padded with 2 spaces and then inserted directly into the document.
19+
# Use pipe (|) for multiline entries.
20+
subtext: Update the metrics type in KafkaMetricsReceiver from "gauge" to "nonmonotonic sum". Changes metrics are, kafka.brokers, kafka.topic.partitions, kafka.partition.replicas, kafka.partition.replicas_in_sync, kafka.consumer_group.members.

receiver/kafkametricsreceiver/documentation.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Number of brokers in the cluster.
1818
1919
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
2020
| ---- | ----------- | ---------- | ----------------------- | --------- |
21-
| {brokers} | Sum | Int | Delta | false |
21+
| {brokers} | Sum | Int | Cumulative | false |
2222
2323
### kafka.consumer_group.lag
2424
@@ -55,9 +55,9 @@ Current approximate sum of consumer group lag across all partitions of topic
5555
5656
Count of members in the consumer group
5757
58-
| Unit | Metric Type | Value Type |
59-
| ---- | ----------- | ---------- |
60-
| {members} | Gauge | Int |
58+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
59+
| ---- | ----------- | ---------- | ----------------------- | --------- |
60+
| {members} | Sum | Int | Cumulative | false |
6161
6262
#### Attributes
6363
@@ -130,9 +130,9 @@ Oldest offset of partition of topic
130130
131131
Number of replicas for partition of topic
132132
133-
| Unit | Metric Type | Value Type |
134-
| ---- | ----------- | ---------- |
135-
| {replicas} | Gauge | Int |
133+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
134+
| ---- | ----------- | ---------- | ----------------------- | --------- |
135+
| {replicas} | Sum | Int | Cumulative | false |
136136
137137
#### Attributes
138138
@@ -145,9 +145,9 @@ Number of replicas for partition of topic
145145
146146
Number of synchronized replicas of partition
147147
148-
| Unit | Metric Type | Value Type |
149-
| ---- | ----------- | ---------- |
150-
| {replicas} | Gauge | Int |
148+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
149+
| ---- | ----------- | ---------- | ----------------------- | --------- |
150+
| {replicas} | Sum | Int | Cumulative | false |
151151
152152
#### Attributes
153153
@@ -160,9 +160,9 @@ Number of synchronized replicas of partition
160160
161161
Number of partitions in topic.
162162
163-
| Unit | Metric Type | Value Type |
164-
| ---- | ----------- | ---------- |
165-
| {partitions} | Gauge | Int |
163+
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
164+
| ---- | ----------- | ---------- | ----------------------- | --------- |
165+
| {partitions} | Sum | Int | Cumulative | false |
166166
167167
#### Attributes
168168

receiver/kafkametricsreceiver/internal/metadata/generated_metrics.go

Lines changed: 33 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/kafkametricsreceiver/internal/metadata/generated_metrics_test.go

Lines changed: 21 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/kafkametricsreceiver/metadata.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ metrics:
2626
sum:
2727
monotonic: false
2828
value_type: int
29-
aggregation: delta
29+
aggregation: cumulative
3030
# topics scraper
3131
kafka.topic.partitions:
3232
enabled: true
3333
description: Number of partitions in topic.
3434
unit: "{partitions}"
35-
gauge:
35+
sum:
36+
monotonic: false
3637
value_type: int
38+
aggregation: cumulative
3739
attributes: [topic]
3840
kafka.partition.current_offset:
3941
enabled: true
@@ -53,23 +55,29 @@ metrics:
5355
enabled: true
5456
description: Number of replicas for partition of topic
5557
unit: "{replicas}"
56-
gauge:
58+
sum:
59+
monotonic: false
5760
value_type: int
61+
aggregation: cumulative
5862
attributes: [topic, partition]
5963
kafka.partition.replicas_in_sync:
6064
enabled: true
6165
description: Number of synchronized replicas of partition
6266
unit: "{replicas}"
63-
gauge:
67+
sum:
68+
monotonic: false
6469
value_type: int
70+
aggregation: cumulative
6571
attributes: [topic, partition]
6672
# consumers scraper
6773
kafka.consumer_group.members:
6874
enabled: true
6975
description: Count of members in the consumer group
7076
unit: "{members}"
71-
gauge:
77+
sum:
78+
monotonic: false
7279
value_type: int
80+
aggregation: cumulative
7381
attributes: [group]
7482
kafka.consumer_group.offset:
7583
enabled: true

receiver/kafkametricsreceiver/testdata/integration/expected.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resourceMetrics:
44
- metrics:
55
- description: Number of brokers in the cluster.
66
sum:
7-
aggregationTemporality: 1
7+
aggregationTemporality: 2
88
dataPoints:
99
- asInt: "1"
1010
startTimeUnixNano: "1685063120199110000"

0 commit comments

Comments
 (0)