failsafe-lib / failsafe

Fault tolerance and resilience patterns for the JVM
https://failsafe.dev
Apache License 2.0
4.16k stars 295 forks source link

Feature: micrometer.io metrics integration #352

Open magicprinc opened 1 year ago

magicprinc commented 1 year ago

If you are looking for new ideas: https://micrometer.io/ Metrics would be great!

It is new SLF4J for metrics and all people I know use it as standard de facto.

If you need something for an inspiration: https://github.com/brettwooldridge/HikariCP/tree/dev/src/main/java/com/zaxxer/hikari/metrics/micrometer

https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java

https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/okhttp3/OkHttpMetricsEventListener.java

jhalterman commented 1 year ago

The approach Failsafe takes is to expose event listeners which could be used to record metrics, which avoids adding any external dependencies. Are there any particular metrics/event listeners that you'd like to see?

magicprinc commented 1 year ago

Metrics are my colleges' responsibility, so I don't have a concrete answer yet :-)

But usually people like if somebody smarter than they—"an expert in the field" have already made decisions.

I know that Hystrix has a lot of metrics, even with HttpServlet to publish them as JSON feed.

Here are your competitors as a source of inspiration: https://resilience4j.readme.io/docs/micrometer

https://github.com/findinpath/spring-retry-metrics

magicprinc commented 1 year ago

Core library without dependencies is a good thing! It could be an additional (optional) artifact.

And people who use let's say Prometheus directly could clone the project and make a "Prometheus metrics for FailSafe"