Skip to content

GH-458: Introduce MetricsRetryListener#459

Merged
artembilan merged 3 commits into
spring-projects:mainfrom
artembilan:GH-458
Aug 13, 2024
Merged

GH-458: Introduce MetricsRetryListener#459
artembilan merged 3 commits into
spring-projects:mainfrom
artembilan:GH-458

Conversation

@artembilan

Copy link
Copy Markdown
Member

Fixes: #458

Comment thread src/main/java/org/springframework/retry/support/MetricsRetryListener.java Outdated
Comment thread src/main/java/org/springframework/retry/support/MetricsRetryListener.java Outdated
Comment thread src/main/java/org/springframework/retry/support/MetricsRetryListener.java Outdated
Comment thread src/main/java/org/springframework/retry/support/MetricsRetryListener.java Outdated
Comment thread src/main/java/org/springframework/retry/support/MetricsRetryListener.java Outdated
@szpak

szpak commented Aug 1, 2024

Copy link
Copy Markdown
Contributor

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

szpak commented Aug 1, 2024

Copy link
Copy Markdown
Contributor

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

@artembilan

Copy link
Copy Markdown
Member Author

"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

…ontext` as a key

* Change `setCustomTags()` to the `@Nullable Iterable<Tag>` argument
* Use `exception = none` tag for successful executions to avoid time-series conflicts
@artembilan artembilan merged commit 9d8df3b into spring-projects:main Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Built-in support for Micrometer metrics publishing

3 participants