JMX Custom Metrics
To configure which JMX metrics to monitor,
edit the agent configuration.yaml file as shown in the
following example:
com.instana.plugin.java:
jmx:
# JMX is NOT hot-reloaded and needs to be set before a JVM is discovered.
# Supported attribute types are Number and Boolean
# delta calculation is only supported for Number
- object_name: 'java.lang:type=Compilation'
metrics:
- attributes: 'TotalCompilationTime'
type: 'delta' # delta will report the change to the previous second
- object_name: 'java.lang:type=ClassLoading'
metrics:
- attributes: 'LoadedClassCount'
type: 'absolute' # absolute will report the value as-is
The configuration.yaml example specifies two types
of metrics:
-
deltais used for values that increase over time, such as counters, where the relative change is considered interesting. -
absoluteis used to show the actual value each time the metric is accessed.
The attribute specified must either be Number (or
one of its subclasses like Integer or
Double) or a String representing a
number.
On the JVM dashboard, the JMX metrics are displayed under Custom JMX metrics.
The object_name may contain wildcard patterns as
specified in Java's
ObjectName API documentation. Here's an example of a
configuration with wildcard patterns:
com.instana.plugin.java:
jmx:
- object_name: 'kafka.*:type=*-metrics,client-id=*,*'
metrics:
- attributes: 'incoming-byte-rate'
type: 'absolute'
- attributes: 'incoming-byte-total'
type: 'absolute'
- attributes: 'outgoing-byte-rate'
type: 'absolute'
- attributes: 'outgoing-byte-total'
type: 'absolute'