Spring Boot version: 3.0.1 Spring Cloud version: 2022.0.0 Java version: 17
After updating to Spring Boot 3 many of the metrics stays always at 0.0:
# HELP resilience4j_timelimiter_calls_total The number of successful calls
# TYPE resilience4j_timelimiter_calls_total counter
resilience4j_timelimiter_calls_total{group="none",kind="successful",name="test",} 0.0
My dependencies:
dependencies {
implementation("org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j")
implementation("org.springframework.cloud:spring-cloud-starter-openfeign")
implementation("io.micrometer:micrometer-core:1.10.3")
implementation("io.micrometer:micrometer-registry-prometheus:1.10.3")
implementation("io.github.resilience4j:resilience4j-micrometer:2.0.2")
...
}
The config:
management:
metrics:
distribution:
percentiles-histogram:
http.server.requests: true
resilience4j.circuitbreaker.calls: true
feign:
circuitbreaker:
enabled: true
Comment From: ryanjbaxter
Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.
Comment From: shellrausch
Here the ready to run example: https://github.com/shellrausch/r4j-springboot3-no-metrics
Steps to reproduce:
1. Start the service
2. Open http://localhost:8080/data in browser (to make an external http reques)
3. Observe http://localhost:8080/prometheus for resilience4j_timelimiter_calls_total
Comment From: ryanjbaxter
Looks like this is something to do with the OpenFeign Integration.
Using Boot 2.7 and Spring Cloud 2021 this is what I see
# HELP resilience4j_timelimiter_calls_total The number of successful calls
# TYPE resilience4j_timelimiter_calls_total counter
resilience4j_timelimiter_calls_total{group="none",kind="timeout",name="httpbin",} 0.0
resilience4j_timelimiter_calls_total{group="HttpBinClient#getSomeData()",kind="timeout",name="HttpBinClient#getSomeData()",} 0.0
resilience4j_timelimiter_calls_total{group="HttpBinClient#getSomeData()",kind="successful",name="HttpBinClient#getSomeData()",} 2.0
resilience4j_timelimiter_calls_total{group="none",kind="successful",name="httpbin",} 0.0
resilience4j_timelimiter_calls_total{group="none",kind="failed",name="httpbin",} 0.0
resilience4j_timelimiter_calls_total{group="HttpBinClient#getSomeData()",kind="failed",name="HttpBinClient#getSomeData()",} 0.0
In Boot 3 with Spring Cloud 2022, I don't see the metrics as you indicated when using OpenFeign but when you use Spring Cloud CircuitBreaker directly I do see the metrics
# HELP resilience4j_timelimiter_calls_total The number of successful calls
# TYPE resilience4j_timelimiter_calls_total counter
resilience4j_timelimiter_calls_total{group="httpbinwithoutfeign",kind="timeout",name="httpbinwithoutfeign",} 0.0
resilience4j_timelimiter_calls_total{group="httpbinwithoutfeign",kind="successful",name="httpbinwithoutfeign",} 1.0
resilience4j_timelimiter_calls_total{group="httpbinwithoutfeign",kind="failed",name="httpbinwithoutfeign",} 0.0
resilience4j_timelimiter_calls_total{group="none",kind="timeout",name="httpbin",} 0.0
resilience4j_timelimiter_calls_total{group="none",kind="successful",name="httpbin",} 0.0
resilience4j_timelimiter_calls_total{group="none",kind="failed",name="httpbin",} 0.0
The difference appears to be in the group attribute, that is no longer there in Spring Cloud OpenFeign 2022.
Comment From: ryanjbaxter
@OlgaMaciaszek does anything pop out to you right away on why this might be? If not I can try and track down then difference
Comment From: OlgaMaciaszek
Other than this change you've added : https://github.com/spring-cloud/spring-cloud-openfeign/blob/7ad582dbe98484a5b35187166c2b3a10a8f9084a/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignAutoConfiguration.java#L189-L195. Not sure if this could have anything to do with that issue @ryanjbaxter ?
Comment From: ryanjbaxter
No I don't think that would do it, at least its not obvious to me. I will have to look into it.
Comment From: ryanjbaxter
I figured out the problem.
@shellrausch you need to change feign.circuitbreaker.enabled=true to spring.cloud.openfeign.circuitbreaker.enabled=true. The property prefix changed in the 2022 release.