spring-projects / spring-retry

2.17k stars 518 forks source link

GH-458: Introduce `MetricsRetryListener` #459

Closed artembilan closed 2 months ago

artembilan commented 3 months ago

Fixes: #458

szpak commented 3 months ago

Thanks @artembilan for your effort! I've just given it a try from the functionality point of view and after defining MetricsRetryListener as a bean, it just worked:

spring_retry_seconds_max{application="x",name="process",retry_count="0",} 0.005874044
spring_retry_seconds_max{application="x",name="process",retry_count="2",} 2.28533499
spring_retry_seconds_count{application="x",name="process",retry_count="0",} 2.0
spring_retry_seconds_count{application="x",name="process",retry_count="2",} 1.0
spring_retry_seconds_sum{application="x",name="process",retry_count="0",} 0.008557336
spring_retry_seconds_sum{application="x",name="process",retry_count="2",} 2.28533499

I will think over, if we would need anything else here, but for now it provides what we need.

szpak commented 3 months ago

Btw, "seconds" looks strange at the first look in the context of the counter ;-).

artembilan commented 3 months ago

"seconds" looks strange at the first look in the context of the counter

Because it is not a counter, but timer. So, it gathers not only a number of call, but also some time measurements for those calls. See Micrometer docs: https://docs.micrometer.io/micrometer/reference/concepts/timers.html