JVM Metrics Producer

The JVM Metrics Producer collects JVM related metrics. It uses java.lang.management.ManagementFactory to get to the underlying managed beans that contain the JVM information.

Add the JVM Metrics Producer dependency to your build:

Dependency

sbt
libraryDependencies += Cinnamon.library.cinnamonJvmMetricsProducer
Maven
<dependency>
    <groupId>com.lightbend.cinnamon</groupId>
    <artifactId>cinnamon-jvm-metrics-producer_2.12</artifactId>
    <version>2.10.0</version>
</dependency>
Gradle
dependencies {
    compile group: 'com.lightbend.cinnamon', name: 'cinnamon-jvm-metrics-producer_2.12', version: '2.10.0'
}

Configuration

Once the dependency has been added there is no need to do any further configuration. By default all types of JVM metrics collected by the producer will generate metrics. This behavior is possible to override with the settings below:

Reference
cinnamon {
  producers += jvm-metrics-producer

  jvm-metrics-producer {

    memory-usage {
      # Enable memory usage metrics
      metrics = on
      # The category name for all memory usage metrics
      category = "memory-usage"
    }

    garbage-collection {
      # Enable garbage collection metrics
      metrics = on
      # The category name for all garbage collection metrics
      category = "garbage-collection"
    }

    class-loading {
      # Enable class loading metrics
      metrics = on
      # The category name for all class loading metrics
      category = "class-loading"
    }
  }
}

Note: These settings are defined in the reference.conf. You only need to specify any of these settings when you want to override the defaults.

Available Metrics

The following metrics is collected by the JVM Metrics Producer:

  • Heap : committed, init, max, used.
  • Non Heap : committed, init, max, used.
  • Total Heap : committed, init, max, used.
  • Memory Pools : committed, init, max, used, usage (for each memory pool)
  • Classes: loaded, unloaded