According to Micrometer's documentation https://micrometer.io/docs/concepts#_server_side, the framework (Micrometer) should handle converting the timer metric to a rate from absolute amount
The below code simulates a dummy timer:
@Service
public class AppService {
private Timer timer = Metrics.timer("foobar");
public String test() {
timer.record(() -> {
try {
Thread.sleep((long) (Math.random() * 1000));
} catch (InterruptedException e) {
e.printStackTrace();
}
});
return "foo";
}
}
However in Prometheus I see only monotonically increasing metrics foobar_seconds_sum
and foobar_seconds_count
instead of seeing them as rates
Perhaps I misunderstood or overlooked something in the documentation?
This is how a Prometheus Summary works, you can calculate the average event size with:
rate(foobar_seconds_sum[5m])
/
rate(foobar_seconds_count[5m])
With Prometheus client libraries are dumb, and should leave more complex math to Prometheus.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With