metrics-jvm-extras

A set of additional metrics complementing Dropwizards metrics-jvm.

License

License

Categories

Categories

Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

io.github.mweirauch
ArtifactId

ArtifactId

metrics-jvm-extras
Last Version

Last Version

0.1.4
Release Date

Release Date

Type

Type

jar
Description

Description

metrics-jvm-extras
A set of additional metrics complementing Dropwizards metrics-jvm.
Source Code Management

Source Code Management

https://github.com/mweirauch/metrics-jvm-extras

Download metrics-jvm-extras

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.mweirauch/metrics-jvm-extras/ -->
<dependency>
    <groupId>io.github.mweirauch</groupId>
    <artifactId>metrics-jvm-extras</artifactId>
    <version>0.1.4</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.mweirauch/metrics-jvm-extras/
implementation 'io.github.mweirauch:metrics-jvm-extras:0.1.4'
// https://jarcasting.com/artifacts/io.github.mweirauch/metrics-jvm-extras/
implementation ("io.github.mweirauch:metrics-jvm-extras:0.1.4")
'io.github.mweirauch:metrics-jvm-extras:jar:0.1.4'
<dependency org="io.github.mweirauch" name="metrics-jvm-extras" rev="0.1.4">
  <artifact name="metrics-jvm-extras" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.mweirauch', module='metrics-jvm-extras', version='0.1.4')
)
libraryDependencies += "io.github.mweirauch" % "metrics-jvm-extras" % "0.1.4"
[io.github.mweirauch/metrics-jvm-extras "0.1.4"]

Dependencies

compile (2)

Group / Artifact Type Version
io.dropwizard.metrics : metrics-core jar 3.2.6
org.slf4j : slf4j-api jar 1.7.26

test (4)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-core jar 2.25.0
com.google.guava : guava-testlib jar 27.1-jre
org.slf4j : slf4j-simple jar 1.7.26

Project Modules

There are no modules declared in this project.

metrics-jvm-extras

A set of additional metrics complementing Dropwizards metrics-jvm.

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 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 -1 if your kernel is older. As with pss, 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 100ms in order to relief the filesystem pressure when Metrics 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

Versions

Version
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0