How can we get the Hazelcast metrics from Hazelcast JMX MBeans using JMX exporter
To get hazelcast metrics using the hazelcast mbeans, we have to use the following configuration as our JMX exporter config.
#---
attrNameSnakeCase: true
lowercaseOutputName: true
lowercaseOutputLabelNames: true
whitelistObjectNames:
- "com.hazelcast:type=Metrics,*"
rules:
- pattern: "^com.hazelcast<type=Metrics, instance=(.*), prefix=(.*), tag([0-9]+)=(.*)><>(.+):"
name: hazelcast_$5
attrNameSnakeCase: true
labels:
instance: $1
prefix: $2
tag$3: $4
- pattern: "^com.hazelcast<type=Metrics, instance=(.*), prefix=(.*)><>(.+):"
name: hazelcast_$3
attrNameSnakeCase: true
labels:
instance: $1
prefix: $2
The example metrics will be like as the following
hazelcast_total_max_get_latency{instance="hz-instance",prefix="map",tag0=""name=request-trace-cache"",} 1.0
hazelcast_priority_queue_size{instance="hz-auth-instance",prefix="operation",} 0.0
It can also handle metrics with multiple map tags.
hazelcast_connection_type{instance="hazelcastCacheInstance",prefix="tcp.connection, tag0="endpoint=[localhost]:5703"",tag1=""bindAddress=[testserver]:5703"",} 1.0