Metrics is a minimal library for various server monitoring metrics, and easy reporting. Supported metrics include rate meters; instant gauges; counters; histograms; timers. Furthermore, various reporting formatting is included. See their Getting started page for more details.
It’s available on Maven Central, so the following Gradle config will include the latest 3.1.0 version.
repositories {
mavenCentral()
}
dependencies {
compile 'io.dropwizard.metrics:metrics-core:3.1.0'
}
The simplified tests in the code below will output this report.
2/9/17 8:10:50 PM =============================================================
-- Histograms ------------------------------------------------------------------
histogram
count = 4
min = 1
max = 3
mean = 2.50
stddev = 0.87
median = 3.00
75% <= 3.00
95% <= 3.00
98% <= 3.00
99% <= 3.00
99.9% <= 3.00
2/9/17 8:10:50 PM =============================================================
-- Gauges ----------------------------------------------------------------------
gauge
value = 123
2/9/17 8:10:50 PM =============================================================
-- Meters ----------------------------------------------------------------------
meter
count = 2
mean rate = 19.68 events/second
1-minute rate = 0.00 events/second
5-minute rate = 0.00 events/second
15-minute rate = 0.00 events/second
2/9/17 8:10:50 PM =============================================================
-- Timers ----------------------------------------------------------------------
timer
count = 1
mean rate = 4.95 calls/second
1-minute rate = 0.00 calls/second
5-minute rate = 0.00 calls/second
15-minute rate = 0.00 calls/second
min = 200.13 milliseconds
max = 200.13 milliseconds
mean = 200.13 milliseconds
stddev = 0.00 milliseconds
median = 200.13 milliseconds
75% <= 200.13 milliseconds
95% <= 200.13 milliseconds
98% <= 200.13 milliseconds
99% <= 200.13 milliseconds
99.9% <= 200.13 milliseconds
2/9/17 8:10:50 PM =============================================================
-- Counters --------------------------------------------------------------------
counter
count = 6
Some metrics examples:
MetricsApiTest.java