in src/main/java/org/apache/sling/commons/metrics/rrd4j/impl/RRD4JReporter.java [227:270]
public void report(SortedMap<String, Gauge> gauges,
SortedMap<String, Counter> counters,
SortedMap<String, Histogram> histograms,
SortedMap<String, Meter> meters,
SortedMap<String, Timer> timers) {
long sampleTime = clock.getTime() / 1000;
if (sampleTime <= lastSampleTime) {
// sample at most once a second
return;
}
long time = System.nanoTime();
int total = gauges.size() + counters.size() + histograms.size() + meters.size() + timers.size();
int reported = 0;
try {
Sample sample = rrdDB.createSample(sampleTime);
for (Map.Entry<String, Gauge> entry : gauges.entrySet()) {
reported += update(sample, entry.getKey(), entry.getValue());
}
for (Map.Entry<String, Counter> entry : counters.entrySet()) {
reported += update(sample, entry.getKey(), entry.getValue());
}
for (Map.Entry<String, Histogram> entry : histograms.entrySet()) {
reported += update(sample, entry.getKey(), entry.getValue());
}
for (Map.Entry<String, Meter> entry : meters.entrySet()) {
reported += update(sample, entry.getKey(), entry.getValue());
}
for (Map.Entry<String, Timer> entry : timers.entrySet()) {
reported += update(sample, entry.getKey(), entry.getValue());
}
sample.update();
} catch (IOException e) {
LOGGER.warn("Unable to write sample to RRD", e);
} finally {
lastSampleTime = sampleTime;
time = System.nanoTime() - time;
LOGGER.debug("{} out of {} metrics reported in {} \u03bcs",
reported, total, TimeUnit.NANOSECONDS.toMicros(time));
}
}