Class ProcessMetrics

Object
ProcessMetrics

public class ProcessMetrics extends Object
Process metrics.

These metrics are defined in the process metrics section of the Prometheus client library documentation, and they are implemented across client libraries in multiple programming languages.

Technically, some of them are OS-level metrics and not JVM-level metrics. However, I'm still putting them in the prometheus-metrics-instrumentation-jvm module, because first it seems overkill to create a separate Maven module just for the ProcessMetrics class, and seconds some of these metrics are coming from the JVM via JMX anyway.

The ProcessMetrics are registered as part of the JvmMetrics like this:


   JvmMetrics.builder().register();
 
However, if you want only the ProcessMetrics you can also register them directly:

   ProcessMetrics.builder().register();
 
Example metrics being exported:
 # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
 # TYPE process_cpu_seconds_total counter
 process_cpu_seconds_total 1.63
 # HELP process_max_fds Maximum number of open file descriptors.
 # TYPE process_max_fds gauge
 process_max_fds 524288.0
 # HELP process_open_fds Number of open file descriptors.
 # TYPE process_open_fds gauge
 process_open_fds 28.0
 # HELP process_resident_memory_bytes Resident memory size in bytes.
 # TYPE process_resident_memory_bytes gauge
 process_resident_memory_bytes 7.8577664E7
 # HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
 # TYPE process_start_time_seconds gauge
 process_start_time_seconds 1.693829439767E9
 # HELP process_virtual_memory_bytes Virtual memory size in bytes.
 # TYPE process_virtual_memory_bytes gauge
 process_virtual_memory_bytes 1.2683624448E10