metrics-jvm-extras
A set of additional metrics complementing Dropwizards metrics-jvm.
Motivation
- get "real" memory usage of the JVM beyond its managed parts
- get ahold of that info from within the JVM in environments where you can't scrape from the outside (e.g. PaaS)
Usage
<dependency>
<groupId>io.github.mweirauch</groupId>
<artifactId>metrics-jvm-extras</artifactId>
<version>x.y.z</version>
</dependency>
metrics.register("jvm.process.mem", new ProcessMemoryUsageGaugeSet());
metrics.register("jvm.process.fds.count", new FileDescriptorCountGauge());
metrics.register("jvm.process.uptime", new UptimeGauge());
Available Metrics
ProcessMemoryUsageGaugeSet
The ProcessMemoryUsageGaugeSet reads values from /proc/self/smaps. Please note that procfs is only available on Linux-based systems.
vss: Virtual set size. The amount of virtual memory the process can access. Mostly useles, but included for completeness sake.rss: Resident set size. The amount of process memory currently in RAM.pss: Proportional set size. The amount of process memory currently in RAM, accounting for shared pages among processes. This metric is the most accurate in terms of "real" memory usage.swap: The amount of process memory paged out to swap.swappss: The amount of process memory paged out to swap accounting for shared memory among processes. Since Linux 4.3. Will return-1if your kernel is older. As withpss, the most accurate metric to watch.
NativeMemoryUsageGaugeSet (deprecated)
Deprecated in favour of ProcessMemoryUsageGaugeSet. Returns the very same values. Will be removed.
FileDescriptorCountGauge
Provides the count of open file descriptors in use by the JVM process.
UptimeGauge
Provides uptime in ms.
Notes
- procfs data is cached for
100msin order to relief the filesystem pressure whenMetrics based on this data are queried by the registry one after another on collection run.
What could be next?
- CPU usage details
- JVM Native Memory Tracking details