---
title: "Configure Java to generate Prometheus metrics | Grafana Cloud documentation"
description: "Configure a Java application to send metrics"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Configure Java to generate Prometheus metrics

Use one of the following options to configure Java to generate Prometheus metrics:

- Install [JMX Exporter](https://github.com/prometheus/jmx_exporter)
- (Recommended) Install [Micrometer Prometheus Exporter](https://micrometer.io/docs/registry/prometheus). The Micrometer exporter provides more information.

## Metrics and KPIs

Expand table

| **Metric**                                                           | **KPI**                                                                                                        |
|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| GC Count<br /><br /><br /><br />jvm\_gc\_pause\_seconds\_count       | Rate of GC Count<br /><br /><br /><br />rate(jvm\_gc\_pause\_seconds\_count{action=“end of major GC”}\[2m])    |
| GC Pause Time<br /><br /><br /><br />jvm\_gc\_pause\_seconds\_sum    | Rate of GC Pause Time<br /><br /><br /><br />rate(jvm\_gc\_pause\_seconds\_sum{action=“end of major GC”}\[2m]) |
| Live Thread Count<br /><br /><br /><br />jvm\_threads\_live\_threads | Live thread count normalized against a threshold<br /><br /><br /><br />jvm\_threads\_live\_threads / 200      |

## Alerts

Expand table

| **KPI**               | **Alert**                       |
|-----------------------|---------------------------------|
| Rate of GC Count      | JvmMajorGCCountHigh             |
| Rate of GC Pause Time | JvmMajorGCTimeHigh              |
| Live Thread Count     | Saturation on jvm:live\_threads |

## Dashboard

The JVM instance KPI dashboard includes metrics for CPU, heap memory, non-heap memory, buffer pools, threads, file descriptors, and classes loaded.

### CPU

- system\_cpu\_usage
- process\_cpu\_usage
- system\_cpu\_count
- system\_load\_average\_1m

### Heap memory

The following heap metrics are available for Eden Space, Survivor Space, and Tenured Generation.

- jvm\_memory\_used\_bytes{area=“heap”}
- jvm\_memory\_committed\_bytes{area=“heap”}
- jvm\_memory\_max\_bytes{area=“heap”}

### Non-heap memory

The following non-heap metrics are available for Metaspace, Compressed Class Space, and Code Cache.

- jvm\_memory\_used\_bytes{area=“nonheap”}
- jvm\_memory\_committed\_bytes{area=“nonheap”}
- jvm\_memory\_max\_bytes{area=“nonheap”}

### Buffer pools

The following metrics are available for Direct and Mapped buffers.

- jvm\_buffer\_total\_capacity\_bytes
- jvm\_buffer\_memory\_used\_bytes
- jvm\_buffer\_count\_buffers

### Threads

- jvm\_threads\_live\_threads
- jvm\_threads\_daemon\_threads
- jvm\_threads\_peak\_threads
- process\_threads
- jvm\_threads\_states\_threads

### File descriptors

- process\_files\_open\_files
- process\_files\_max\_files

### Classes loaded

- jvm\_classes\_loaded\_classes
