You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: instrumentation/jmx-metrics/javaagent/README.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,6 +221,54 @@ Thus, the above definitions will create several metrics, named `my.kafka.streams
221
221
222
222
The metric descriptions will remain undefined, unless they are provided by the queried MBeans.
223
223
224
+
### State Metrics
225
+
226
+
Some JMX attributes expose current state as a non-numeric MBean attribute, in order to capture those as metrics it is recommended to use the special `state` metric type.
227
+
For example, with Tomcat connector, the `Catalina:type=Connector,port=*` MBean has `stateName` (of type `String`), we can define the following rule:
228
+
229
+
```yaml
230
+
---
231
+
rules:
232
+
- bean: Catalina:type=Connector,port=*
233
+
mapping:
234
+
stateName:
235
+
type: state
236
+
metric: tomcat.connector.state
237
+
metricAttribute:
238
+
port: param(port)
239
+
state:
240
+
ok: STARTED
241
+
failed: [STOPPED,FAILED]
242
+
degraded: '*'
243
+
```
244
+
245
+
For a given value of `port`, let's say `8080` This will capture the `tomcat.connector.state` metric of type `updowncounter` with value `0` or `1` and the `state` metric attribute will have a value in [`ok`,`failed`,`degraded`].
246
+
For every sample, 3 metrics will be captured for each value of `state` depending on the value of `stateName`:
Each state key can be mapped to one or more values of the MBean attribute using:
267
+
- a string literal or a string array
268
+
- a `*` wildcard to provide default option and avoid enumerating all values.
269
+
270
+
Exactly one wildcard is expected to be present in the mapping to ensure all possible values of the MBean attribute can be mapped to a state key.
271
+
224
272
### General Syntax
225
273
226
274
Here is the general description of the accepted configuration file syntax. The whole contents of the file is case-sensitive, with exception for `type` as described in the table below.
0 commit comments