Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can We will use the following examples:

Table of Contents
excludeSee also

...

example to show how you can measure Java garbage collection with Prometheus.

GarbageCollector statistics is one of the of metrics that the Java/JVM client library exposes.

...

The GarbageCollector statistics comes from GarbageCollectorMXBean, and is exposed as the jvm_gc_collection_seconds summary.
In particular, jvm_gc_collection_seconds_count is responsible for the number of GCs, and jvm_gc_collection_seconds_sum  deals with for how long they were taken.

These are the counters, so we can take a rate:

...

We can see that PS Scavenge is happening once every 2 seconds or so, and PS MarkSweek is rare. You can have a question  might ask which of those are the young generation and which the old/tenured, but this is not something the JVM exposes so you have to know this in your setup given the name.

...

Configuring Prometheus Exporters

JVM metrics