Skip to content

Commit 665c390

Browse files
committed
JMX Scraper: reverted some metric name changes
JMX Metrics: metric descriptions updated to match common convention
1 parent 31c4fc4 commit 665c390

File tree

4 files changed

+30
-54
lines changed

4 files changed

+30
-54
lines changed

jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/KafkaIntegrationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,25 +165,25 @@ List<Consumer<Metric>> kafkaBrokerAssertions() {
165165
assertGauge(
166166
metric,
167167
"kafka.controller.active.count",
168-
"controller is active on broker",
168+
"For KRaft mode, the number of active controllers in the cluster. For ZooKeeper, indicates whether the broker is the controller broker.",
169169
"{controller}"),
170170
metric ->
171171
assertSum(
172172
metric,
173173
"kafka.leader.election.rate",
174-
"leader election rate - increasing indicates broker failures",
174+
"Leader election rate - increasing indicates broker failures",
175175
"{election}"),
176176
metric ->
177177
assertGauge(
178178
metric,
179179
"kafka.max.lag",
180-
"max lag in messages between follower and leader replicas",
180+
"Max lag in messages between follower and leader replicas",
181181
"{message}"),
182182
metric ->
183183
assertSum(
184184
metric,
185185
"kafka.unclean.election.rate",
186-
"unclean leader election rate - increasing indicates broker failures",
186+
"Unclean leader election rate - increasing indicates broker failures",
187187
"{election}"));
188188
}
189189

jmx-metrics/src/main/resources/target-systems/kafka.groovy

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,29 +167,29 @@ otel.instrument(isrOperations,
167167

168168

169169
def maxLag = otel.mbean("kafka.server:type=ReplicaFetcherManager,name=MaxLag,clientId=Replica")
170-
otel.instrument(maxLag, "kafka.max.lag", "max lag in messages between follower and leader replicas",
170+
otel.instrument(maxLag, "kafka.max.lag", "Max lag in messages between follower and leader replicas",
171171
"{message}", "Value", otel.&longValueCallback)
172172

173173
def activeControllerCount = otel.mbean("kafka.controller:type=KafkaController,name=ActiveControllerCount")
174-
otel.instrument(activeControllerCount, "kafka.controller.active.count", "controller is active on broker",
174+
otel.instrument(activeControllerCount, "kafka.controller.active.count", "For KRaft mode, the number of active controllers in the cluster. For ZooKeeper, indicates whether the broker is the controller broker.",
175175
"{controller}", "Value", otel.&longValueCallback)
176176

177177
def leaderElectionRate = otel.mbean("kafka.controller:type=ControllerStats,name=LeaderElectionRateAndTimeMs")
178-
otel.instrument(leaderElectionRate, "kafka.leader.election.rate", "leader election rate - increasing indicates broker failures",
178+
otel.instrument(leaderElectionRate, "kafka.leader.election.rate", "Leader election rate - increasing indicates broker failures",
179179
"{election}", "Count", otel.&longCounterCallback)
180180

181181
def uncleanLeaderElections = otel.mbean("kafka.controller:type=ControllerStats,name=UncleanLeaderElectionsPerSec")
182-
otel.instrument(uncleanLeaderElections, "kafka.unclean.election.rate", "unclean leader election rate - increasing indicates broker failures",
182+
otel.instrument(uncleanLeaderElections, "kafka.unclean.election.rate", "Unclean leader election rate - increasing indicates broker failures",
183183
"{election}", "Count", otel.&longCounterCallback)
184184

185185
def requestQueueSize = otel.mbean("kafka.network:type=RequestChannel,name=RequestQueueSize")
186-
otel.instrument(requestQueueSize, "kafka.request.queue", "size of the request queue",
186+
otel.instrument(requestQueueSize, "kafka.request.queue", "Size of the request queue",
187187
"{request}", "Value", otel.&longValueCallback)
188188

189189
def logFlushRate = otel.mbean("kafka.log:type=LogFlushStats,name=LogFlushRateAndTimeMs")
190-
otel.instrument(logFlushRate, "kafka.logs.flush.time.count", "log flush count",
190+
otel.instrument(logFlushRate, "kafka.logs.flush.time.count", "Log flush count",
191191
"ms", "Count", otel.&longCounterCallback)
192-
otel.instrument(logFlushRate, "kafka.logs.flush.time.median", "log flush time - 50th percentile",
192+
otel.instrument(logFlushRate, "kafka.logs.flush.time.median", "Log flush time - 50th percentile",
193193
"ms", "50thPercentile", otel.&doubleValueCallback)
194-
otel.instrument(logFlushRate, "kafka.logs.flush.time.99p", "log flush time - 99th percentile",
194+
otel.instrument(logFlushRate, "kafka.logs.flush.time.99p", "Log flush time - 99th percentile",
195195
"ms", "99thPercentile", otel.&doubleValueCallback)

jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/kafka/KafkaIntegrationTest.java

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected MetricsVerifier createMetricsVerifier() {
9696
metric
9797
.hasDescription("The number of requests waiting in purgatory")
9898
.hasUnit("{request}")
99-
.isUpDownCounter()
99+
.isGauge()
100100
.hasDataPointsWithAttributes(
101101
attributeGroup(attribute("type", "Produce")),
102102
attributeGroup(attribute("type", "Fetch"))))
@@ -140,7 +140,7 @@ protected MetricsVerifier createMetricsVerifier() {
140140
metric
141141
.hasDescription("Size of the request queue")
142142
.hasUnit("{request}")
143-
.isUpDownCounter()
143+
.isGauge()
144144
.hasDataPointsWithoutAttributes())
145145
.add(
146146
"kafka.partition.count",
@@ -180,20 +180,21 @@ protected MetricsVerifier createMetricsVerifier() {
180180
"kafka.controller.active.count",
181181
metric ->
182182
metric
183-
.hasDescription("The number of controllers active on the broker") // CHANGED
183+
.hasDescription(
184+
"For KRaft mode, the number of active controllers in the cluster. For ZooKeeper, indicates whether the broker is the controller broker.")
184185
.hasUnit("{controller}")
185-
.isUpDownCounter() // CHANGED
186+
.isGauge()
186187
.hasDataPointsWithoutAttributes())
187188
.add(
188-
"kafka.leader.election.count", // CHANGED from "kafka.leader.election.rate"
189+
"kafka.leader.election.rate",
189190
metric ->
190191
metric
191192
.hasDescription("The leader election count")
192193
.hasUnit("{election}")
193194
.isCounter()
194195
.hasDataPointsWithoutAttributes())
195196
.add(
196-
"kafka.leader.election.unclean.count", // CHANGED from "kafka.unclean.election.rate"
197+
"kafka.unclean.election.rate",
197198
metric ->
198199
metric
199200
.hasDescription(
@@ -202,40 +203,13 @@ protected MetricsVerifier createMetricsVerifier() {
202203
.isCounter()
203204
.hasDataPointsWithoutAttributes())
204205
.add(
205-
"kafka.lag.max", // CHANGED from "kafka.max.lag"
206+
"kafka.max.lag",
206207
metric ->
207208
metric
208209
.hasDescription(
209210
"The max lag in messages between follower and leader replicas") // CHANGED
210211
.hasUnit("{message}")
211212
.isGauge()
212-
.hasDataPointsWithoutAttributes())
213-
214-
// TODO: Find out how to force Kafka to generate these metrics
215-
// .add(
216-
// "kafka.logs.flush.count",
217-
// metric ->
218-
// metric
219-
// .hasDescription("Log flush count")
220-
// .hasUnit("{flush}")
221-
// .isCounter()
222-
// .hasDataPointsWithoutAttributes())
223-
// .add(
224-
// "kafka.logs.flush.time.median",
225-
// metric ->
226-
// metric
227-
// .hasDescription("Log flush time - 50th percentile")
228-
// .hasUnit("ms")
229-
// .isGauge()
230-
// .hasDataPointsWithoutAttributes())
231-
// .add(
232-
// "kafka.logs.flush.time.99p",
233-
// metric ->
234-
// metric
235-
// .hasDescription("Log flush time - 99th percentile")
236-
// .hasUnit("ms")
237-
// .isGauge()
238-
// .hasDataPointsWithoutAttributes())
239-
;
213+
.hasDataPointsWithoutAttributes());
240214
}
241215
}

jmx-scraper/src/main/resources/kafka.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ rules:
8080
mapping:
8181
Value:
8282
metric: kafka.request.queue
83-
type: updowncounter
83+
type: gauge
8484
desc: Size of the request queue
8585
unit: "{request}"
8686

@@ -112,7 +112,7 @@ rules:
112112
mapping:
113113
Value:
114114
metric: kafka.purgatory.size
115-
type: updowncounter
115+
type: gauge
116116
desc: The number of requests waiting in purgatory
117117
unit: "{request}"
118118

@@ -163,30 +163,32 @@ rules:
163163
- bean: kafka.server:type=ReplicaFetcherManager,name=MaxLag,clientId=Replica
164164
mapping:
165165
Value:
166-
metric: kafka.lag.max
166+
metric: kafka.max.lag
167+
type: gauge
167168
desc: The max lag in messages between follower and leader replicas
168169
unit: "{message}"
169170

171+
170172
- bean: kafka.controller:type=KafkaController,name=ActiveControllerCount
171173
mapping:
172174
Value:
173175
metric: kafka.controller.active.count
174-
type: updowncounter
175-
desc: The number of controllers active on the broker
176+
type: gauge
177+
desc: For KRaft mode, the number of active controllers in the cluster. For ZooKeeper, indicates whether the broker is the controller broker.
176178
unit: "{controller}"
177179

178180
- bean: kafka.controller:type=ControllerStats,name=LeaderElectionRateAndTimeMs
179181
mapping:
180182
Count:
181-
metric: kafka.leader.election.count
183+
metric: kafka.leader.election.rate
182184
type: counter
183185
desc: The leader election count
184186
unit: "{election}"
185187

186188
- bean: kafka.controller:type=ControllerStats,name=UncleanLeaderElectionsPerSec
187189
mapping:
188190
Count:
189-
metric: kafka.leader.election.unclean.count
191+
metric: kafka.unclean.election.rate
190192
type: counter
191193
desc: Unclean leader election count - increasing indicates broker failures
192194
unit: "{election}"

0 commit comments

Comments
 (0)