Skip to content

Commit 230140a

Browse files
committed
Add configuration for JMX metrics.
1 parent 6eac60e commit 230140a

File tree

6 files changed

+489
-0
lines changed

6 files changed

+489
-0
lines changed

instrumentation/jmx-metrics/src/main/resources/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ instrumentation support the same metrics as the [JMX Metric Gatherer](https://gi
44

55
It is required at least until [open-telemetry/opentelemetry-java-instrumentation#9765](https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/9765) is addressed.
66

7+
### view.yaml
8+
A [Metric View](https://opentelemetry.io/docs/specs/otel/metrics/sdk/#view) is functionality the OpenTelemetry SDK
9+
supports that allows users to customize the metrics outputted by the SDK. The SDK also supports [configuring views
10+
via YAML](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/incubator#view-file-configuration),
11+
which can be specified via property or environment variable. In this case, the view is configured to only retain metrics
12+
from the JMX Metric Insight instrumentation.
13+
714
```
815
OTEL_EXPERIMENTAL_METRICS_VIEW_CONFIG: classpath:/jmx/view.yaml
916
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
rules:
3+
- bean: kafka.consumer:client-id=*,type=consumer-fetch-manager-metrics
4+
metricAttribute:
5+
client-id: param(client-id)
6+
mapping:
7+
fetch-rate:
8+
metric: kafka.consumer.fetch-rate
9+
type: gauge
10+
desc: The number of fetch requests for all topics per second
11+
unit: "1"
12+
records-lag-max:
13+
metric: kafka.consumer.records-lag-max
14+
type: gauge
15+
desc: Number of messages the consumer lags behind the producer
16+
unit: "1"
17+
bytes-consumed-rate:
18+
metric: kafka.consumer.total.bytes-consumed-rate
19+
type: gauge
20+
desc: The average number of bytes consumed for all topics per second
21+
unit: by
22+
fetch-size-avg:
23+
metric: kafka.consumer.total.fetch-size-avg
24+
type: gauge
25+
desc: The average number of bytes fetched per request for all topics
26+
unit: by
27+
records-consumed-rate:
28+
metric: kafka.consumer.total.records-consumed-rate
29+
type: gauge
30+
desc: The average number of records consumed for all topics per second
31+
unit: "1"
32+
- bean: kafka.consumer:client-id=*,topic=*,type=consumer-fetch-manager-metrics
33+
metricAttribute:
34+
client-id: param(client-id)
35+
topic: param(topic)
36+
mapping:
37+
bytes-consumed-rate:
38+
metric: kafka.consumer.bytes-consumed-rate
39+
type: gauge
40+
desc: The average number of bytes consumed per second
41+
unit: by
42+
fetch-size-avg:
43+
metric: kafka.consumer.fetch-size-avg
44+
type: gauge
45+
desc: The average number of bytes fetched per request
46+
unit: by
47+
records-consumed-rate:
48+
metric: kafka.consumer.records-consumed-rate
49+
type: gauge
50+
desc: The average number of records consumed per second
51+
unit: "1"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
rules:
3+
- bean: kafka.producer:client-id=*,type=producer-metrics
4+
metricAttribute:
5+
client-id: param(client-id)
6+
mapping:
7+
io-wait-time-ns-avg:
8+
metric: kafka.producer.io-wait-time-ns-avg
9+
type: gauge
10+
desc: The average length of time the I/O thread spent waiting for a socket ready for reads or writes
11+
unit: ns
12+
outgoing-byte-rate:
13+
metric: kafka.producer.outgoing-byte-rate
14+
type: gauge
15+
desc: The average number of outgoing bytes sent per second to all servers
16+
unit: by
17+
request-latency-avg:
18+
metric: kafka.producer.request-latency-avg
19+
type: gauge
20+
desc: The average request latency
21+
unit: ms
22+
request-rate:
23+
metric: kafka-producer.request-rate
24+
type: gauge
25+
desc: The average number of requests sent per second
26+
unit: "1"
27+
response-rate:
28+
metric: kafka.producer.response-rate
29+
type: gauge
30+
desc: Responses received per second
31+
unit: "1"
32+
- bean: kafka.producer:client-id=*,topic=*,type=producer-topic-metrics
33+
metricAttribute:
34+
client-id: param(client-id)
35+
topic: param(topic)
36+
mapping:
37+
byte-rate:
38+
metric: kafka.producer.byte-rate
39+
type: gauge
40+
desc: The average number of bytes sent per second for a topic
41+
unit: by
42+
compression-rate:
43+
metric: kafka.producer.compression-rate
44+
type: gauge
45+
desc: The average compression rate of record batches for a topic
46+
unit: "1"
47+
record-error-rate:
48+
metric: kafka.producer.record-error-rate
49+
type: gauge
50+
desc: The average per-second number of record sends that resulted in errors for a topic
51+
unit: "1"
52+
record-retry-rate:
53+
metric: kafka.producer.record-retry-rate
54+
type: gauge
55+
desc: The average per-second number of retried record sends for a topic
56+
unit: "1"
57+
record-send-rate:
58+
metric: kafka.producer.record-send-rate
59+
type: gauge
60+
desc: The average number of records sent per second for a topic
61+
unit: "1"
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
---
2+
rules:
3+
- bean: kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec
4+
mapping:
5+
Count:
6+
metric: kafka.message.count
7+
type: counter
8+
desc: The number of messages received by the broker
9+
unit: "{messages}"
10+
- bean: kafka.server:type=BrokerTopicMetrics,name=TotalProduceRequestsPerSec
11+
metricAttribute:
12+
type: const(produce)
13+
mapping:
14+
Count:
15+
metric: kafka.request.count
16+
type: counter
17+
desc: The number of requests received by the broker
18+
unit: "{requests}"
19+
- bean: kafka.server:type=BrokerTopicMetrics,name=TotalFetchRequestsPerSec
20+
metricAttribute:
21+
type: const(fetch)
22+
mapping:
23+
Count:
24+
metric: kafka.request.count
25+
type: counter
26+
desc: The number of requests received by the broker
27+
unit: "{requests}"
28+
- bean: kafka.server:type=BrokerTopicMetrics,name=FailedProduceRequestsPerSec
29+
metricAttribute:
30+
type: const(produce)
31+
mapping:
32+
Count:
33+
metric: kafka.request.failed
34+
type: counter
35+
desc: The number of requests to the broker resulting in a failure
36+
unit: "{requests}"
37+
- bean: kafka.server:type=BrokerTopicMetrics,name=FailedFetchRequestsPerSec
38+
metricAttribute:
39+
type: const(fetch)
40+
mapping:
41+
Count:
42+
metric: kafka.request.failed
43+
type: counter
44+
desc: The number of requests to the broker resulting in a failure
45+
unit: "{requests}"
46+
- bean: kafka.network:type=RequestMetrics,name=TotalTimeMs,request=Produce
47+
metricAttribute:
48+
type: const(produce)
49+
unit: ms
50+
mapping:
51+
Count:
52+
metric: kafka.request.time.total
53+
type: counter
54+
desc: The total time the broker has taken to service requests
55+
50thPercentile:
56+
metric: kafka.request.time.50p
57+
type: gauge
58+
desc: The 50th percentile time the broker has taken to service requests
59+
99thPercentile:
60+
metric: kafka.request.time.99p
61+
type: gauge
62+
desc: The 99th percentile time the broker has taken to service requests
63+
Mean:
64+
metric: kafka.request.time.avg
65+
type: gauge
66+
desc: The average time the broker has taken to service requests
67+
- bean: kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchConsumer
68+
metricAttribute:
69+
type: const(fetchconsumer)
70+
unit: ms
71+
mapping:
72+
Count:
73+
metric: kafka.request.time.total
74+
type: counter
75+
desc: The total time the broker has taken to service requests
76+
50thPercentile:
77+
metric: kafka.request.time.50p
78+
type: gauge
79+
desc: The 50th percentile time the broker has taken to service requests
80+
99thPercentile:
81+
metric: kafka.request.time.99p
82+
type: gauge
83+
desc: The 99th percentile time the broker has taken to service requests
84+
Mean:
85+
metric: kafka.request.time.avg
86+
type: gauge
87+
desc: The average time the broker has taken to service requests
88+
- bean: kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchFollower
89+
metricAttribute:
90+
type: const(fetchfollower)
91+
unit: ms
92+
mapping:
93+
Count:
94+
metric: kafka.request.time.total
95+
type: counter
96+
desc: The total time the broker has taken to service requests
97+
50thPercentile:
98+
metric: kafka.request.time.50p
99+
type: gauge
100+
desc: The 50th percentile time the broker has taken to service requests
101+
99thPercentile:
102+
metric: kafka.request.time.99p
103+
type: gauge
104+
desc: The 99th percentile time the broker has taken to service requests
105+
Mean:
106+
metric: kafka.request.time.avg
107+
type: gauge
108+
desc: The average time the broker has taken to service requests
109+
- bean: kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec
110+
metricAttribute:
111+
direction: const(in)
112+
mapping:
113+
Count:
114+
metric: kafka.network.io
115+
type: counter
116+
desc: The bytes received or sent by the broker
117+
unit: by
118+
- bean: kafka.server:type=BrokerTopicMetrics,name=BytesOutPerSec
119+
metricAttribute:
120+
direction: const(out)
121+
mapping:
122+
Count:
123+
metric: kafka.network.io
124+
type: counter
125+
desc: The bytes received or sent by the broker
126+
unit: by
127+
- bean: kafka.server:type=DelayedOperationPurgatory,name=PurgatorySize,delayedOperation=Produce
128+
metricAttribute:
129+
type: const(produce)
130+
mapping:
131+
Value:
132+
metric: kafka.purgatory.size
133+
type: gauge
134+
desc: The number of requests waiting in purgatory
135+
unit: "{requests}"
136+
- bean: kafka.server:type=DelayedOperationPurgatory,name=PurgatorySize,delayedOperation=Fetch
137+
metricAttribute:
138+
type: const(fetch)
139+
mapping:
140+
Value:
141+
metric: kafka.purgatory.size
142+
type: gauge
143+
desc: The number of requests waiting in purgatory
144+
unit: "{requests}"
145+
- bean: kafka.server:type=ReplicaManager,name=PartitionCount
146+
mapping:
147+
Value:
148+
metric: kafka.partition.count
149+
type: gauge
150+
desc: The number of partitions on the broker
151+
unit: "{partitions}"
152+
- bean: kafka.controller:type=KafkaController,name=OfflinePartitionsCount
153+
mapping:
154+
Value:
155+
metric: kafka.partition.offline
156+
type: gauge
157+
desc: The number of partitions offline
158+
unit: "{partitions}"
159+
- bean: kafka.server:type=ReplicaManager,name=UnderReplicatedPartitions
160+
mapping:
161+
Value:
162+
metric: kafka.partition.under_replicated
163+
type: gauge
164+
desc: The number of under replicated partitions
165+
unit: "{partitions}"
166+
- bean: kafka.server:type=ReplicaManager,name=IsrShrinksPerSec
167+
metricAttribute:
168+
operation: const(shrink)
169+
mapping:
170+
Count:
171+
metric: kafka.isr.operation.count
172+
type: counter
173+
desc: The number of in-sync replica shrink and expand operations
174+
unit: "{operations}"
175+
- bean: kafka.server:type=ReplicaManager,name=IsrExpandsPerSec
176+
metricAttribute:
177+
operation: const(expand)
178+
mapping:
179+
Count:
180+
metric: kafka.isr.operation.count
181+
type: counter
182+
desc: The number of in-sync replica shrink and expand operations
183+
unit: "{operations}"
184+
- bean: kafka.server:type=ReplicaFetcherManager,name=MaxLag,clientId=Replica
185+
mapping:
186+
Value:
187+
metric: kafka.max.lag
188+
type: gauge
189+
desc: max lag in messages between follower and leader replicas
190+
unit: "{messages}"
191+
- bean: kafka.controller:type=KafkaController,name=ActiveControllerCount
192+
mapping:
193+
Value:
194+
metric: kafka.controller.active.count
195+
type: gauge
196+
desc: controller is active on broker
197+
unit: "{controllers}"
198+
- bean: kafka.controller:type=ControllerStats,name=LeaderElectionRateAndTimeMs
199+
mapping:
200+
Count:
201+
metric: kafka.leader.election.rate
202+
type: counter
203+
desc: leader election rate - increasing indicates broker failures
204+
unit: "{elections}"
205+
- bean: kafka.controller:type=ControllerStats,name=UncleanLeaderElectionsPerSec
206+
mapping:
207+
Count:
208+
metric: kafka.unclean.election.rate
209+
type: counter
210+
desc: unclean leader election rate - increasing indicates broker failures
211+
unit: "{elections}"
212+
- bean: kafka.network:type=RequestChannel,name=RequestQueueSize
213+
mapping:
214+
Value:
215+
metric: kafka.request.queue
216+
type: gauge
217+
desc: size of the request queue
218+
unit: "{requests}"
219+
- bean: kafka.log:type=LogFlushStats,name=LogFlushRateAndTimeMs
220+
unit: ms
221+
prefix: kafka.logs.flush.time.
222+
mapping:
223+
Count:
224+
metric: count
225+
type: counter
226+
desc: log flush count
227+
50thPercentile:
228+
metric: median
229+
type: gauge
230+
desc: log flush time - 50th percentile
231+
99thPercentile:
232+
metric: 99p
233+
type: gauge
234+
desc: log flush time - 99th percentile

0 commit comments

Comments
 (0)