Skip to content

MrMarkW/micrometer-jvm-extras

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

micrometer-jvm-extras

A set of additional JVM process metrics for micrometer.io.

Apache License 2 Travis CI Codacy grade Maven Central

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 instrument from the outside (e.g. PaaS)

Usage

<dependency>
    <groupId>io.github.mweirauch</groupId>
    <artifactId>micrometer-jvm-extras</artifactId>
    <version>x.y.z</version>
</dependency>
    /* Plain Java */
    final MeterRegistry registry = new SimpleMeterRegistry();
    new ProcessMemoryMetrics().bindTo(registry);
    new ProcessThreadMetrics().bindTo(registry);
    /* With Spring */
    @Bean
    public MeterBinder processMemoryMetrics() {
        return new ProcessMemoryMetrics();
    }

    @Bean
    public MeterBinder processThreadMetrics() {
        return new ProcessThreadMetrics();
    }

Available Metrics

ProcessMemoryMetrics

ProcessMemoryMetrics reads process-level memory information from /proc/self/smaps. All Meters are reporting in bytes. Please note that procfs is only available on Linux-based systems.

  • process.memory.vss: Virtual set size. The amount of virtual memory the process can access. Mostly useles, but included for completeness sake.
  • process.memory.rss: Resident set size. The amount of process memory currently in RAM.
  • process.memory.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.
  • process.memory.swap: The amount of process memory paged out to swap.
  • process.memory.swappss: The amount of process memory paged out to swap accounting for shared memory among processes. Since Linux 4.3. Will return -1 if your kernel is older. As with pss, the most accurate metric to watch.

ProcessThreadMetrics

ProcessThreadMetrics reads process-level thread information from /proc/self/status. Please note that procfs is only available on Linux-based systems.

  • process.threads: The number of process threads as seen by the operating system.

Notes

  • procfs data is cached for 100ms in order to relief the filesystem pressure when Meters based on this data are queried by the registry one after another on collection run.

About

A set of additional JVM process metrics for micrometer.io.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%