Can anyone explain me what are the differences between _count
and _sum
metrics exposed by micrometer @Timed
annotation.
Here you have two examples of metrics values as results of a @Timed
annotation post upon a method.
GET_CARD_LIMITS_BY_LIMIT_TYPE_seconds_count{class="ro.orange.productsbff.infrastructure.adapter.cms.integration.CmsClient",method="getCardLimitsByType",} 9.0
GET_CARD_LIMITS_BY_LIMIT_TYPE_seconds_sum{class="ro.orange.productsbff.infrastructure.adapter.cms.integration.CmsClient",method="getCardLimitsByType",} 1.838999262
Thank you!
The count
is the total measurements that the timer has taken. The sum
is the cumulative duration of all the measurements that the time has taken. So by dividing the sum by the count you can see that average timing:
GET_CARD_LIMITS_BY_LIMIT_TYPE_seconds_sum /
GET_CARD_LIMITS_BY_LIMIT_TYPE_seconds_count
However that can become less useful over time since that average could hide spikes as the values grow.
Since both those numbers will only go up (accounting for restarts), Prometheus can leverage that knowledge and you can see the 1 minute average latency for that timer like so:
increase(GET_CARD_LIMITS_BY_LIMIT_TYPE_seconds_sum[1m]) /
increase(GET_CARD_LIMITS_BY_LIMIT_TYPE_seconds_count[1m])
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