Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with metrics end points #1059

Closed
esteve8 opened this issue Jul 1, 2020 · 34 comments
Closed

Problem with metrics end points #1059

esteve8 opened this issue Jul 1, 2020 · 34 comments
Labels

Comments

@esteve8
Copy link

esteve8 commented Jul 1, 2020

Resilience4j version: 1.4.0

Java version: 11

hello! i have a problem with the end points for metrics, for me doesn't work these 3 end points

/actuator/circuitbreakerevents
/actuator/metrics
/actuator/prometheus

My config

implementation "org.springframework.boot:spring-boot-starter-actuator"
 ...
implementation ("io.github.resilience4j:resilience4j-spring-boot2:1.4.0")
implementation ("org.springframework.boot:spring-boot-starter-aop")
implementation ("io.micrometer:micrometer-registry-prometheus")

Do you need an extra configuration?

Best regards

@esteve8
Copy link
Author

esteve8 commented Jul 1, 2020

I forgot to say that i also have this

management.health.circuitbreakers.enabled: true
management.health.ratelimiters.enabled: true

resilience4j.circuitbreaker:
configs:
default:
registerHealthIndicator: true

resilience4j.ratelimiter:
configs:
default:
registerHealthIndicator: true

@dlsrb6342
Copy link
Member

Hi @esteve8
Did you set management.endpoints.web.exposure.include?

management.endpoints.web.exposure.include: ["metrics", "prometheus", "circuitbreakers", "circuitbreakerevents"]

@RobWin RobWin added the question label Jul 1, 2020
@esteve8
Copy link
Author

esteve8 commented Jul 1, 2020

Hello @dlsrb6342 !! Nice to meet you :)

opps, you're right! now i have this error starting the app:

Description:

Parameter 2 of method circuitBreakersHealthIndicator in io.github.resilience4j.circuitbreaker.autoconfigure.CircuitBreakersHealthIndicatorAutoConfiguration required a bean of type 'org.springframework.boot.actuate.health.HealthAggregator' that could not be found.

Action:

Consider defining a bean of type 'org.springframework.boot.actuate.health.HealthAggregator' in your configuration.

@RobWin
Copy link
Member

RobWin commented Jul 1, 2020

Which Spring Boot 2 version do you use?

@esteve8
Copy link
Author

esteve8 commented Jul 1, 2020

the 2.2.7.RELEASE

@RobWin
Copy link
Member

RobWin commented Jul 1, 2020

Please update to Resilience4j 1.5.0

@esteve8
Copy link
Author

esteve8 commented Jul 1, 2020

Now the message has changed:

Parameter 2 of method circuitBreakersHealthIndicator in io.github.resilience4j.circuitbreaker.autoconfigure.CircuitBreakersHealthIndicatorAutoConfiguration required a bean of type 'org.springframework.boot.actuate.health.StatusAggregator' that could not be found.

Action:

Consider defining a bean of type 'org.springframework.boot.actuate.health.StatusAggregator' in your configuration.

@RobWin
Copy link
Member

RobWin commented Jul 1, 2020

Sry I was wrong. Resilience 1.5 requires Spring Boot 2.3.x

@esteve8
Copy link
Author

esteve8 commented Jul 1, 2020

And with 2.2.7.RELEASE of spring boot what version is the best of Resilience? included for manage the actuators healths, metrics etc

@RobWin
Copy link
Member

RobWin commented Jul 1, 2020

The demo currently uses Spring Boot 2.2.4 and Resilience 1.4
https://github.com/resilience4j/resilience4j-spring-boot2-demo/blob/master/build.gradle
I'm not sure if there are non-backward compatible changes in Spring Boot 2.2.7

@esteve8
Copy link
Author

esteve8 commented Jul 1, 2020

Now i just have the configuration like you say but i still have the error :(

Parameter 2 of method circuitBreakersHealthIndicator in io.github.resilience4j.circuitbreaker.autoconfigure.CircuitBreakersHealthIndicatorAutoConfiguration required a bean of type 'org.springframework.boot.actuate.health.HealthAggregator' that could not be found.

Where i can define the HealthAggregator bean??

thanks so much for your help

@dlsrb6342
Copy link
Member

dlsrb6342 commented Jul 1, 2020

It should be configured by spring-boot-actuator-autoconfigure which is included in spring-boot-starter-actuator.

Could you change implementation to api in build.gradle?

api "org.springframework.boot:spring-boot-starter-actuator"

@esteve8
Copy link
Author

esteve8 commented Jul 1, 2020

hi @dlsrb6342! i did it like you said:

api "org.springframework.boot:spring-boot-starter-actuator"

But i have the same error:

onfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'circuitBreakersHealthIndicator' defined in class path resource [io/github/resilience4j/circuitbreaker/autoconfigure/CircuitBreakersHealthIndicatorAutoConfiguration.class]: Unsatisfied dependency expressed through method 'circuitBreakersHealthIndicator' parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.actuate.health.HealthAggregator' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

i don't undestand what is the problem :(

@dlsrb6342
Copy link
Member

Can you provide a sample that reproduces the problem as a GitHub (or similar) project or attached to this issue as a zip file?

@esteve8
Copy link
Author

esteve8 commented Jul 3, 2020

hello! the problem is that I have a microservices architecture with many modules and it is difficult to extract the problem to a simple project because the conditions will not be the same.. I can show you the microservice gradle.properties that uses the circuit breaker. Can it be useful to you? I really appreciate your help.

https://drive.google.com/file/d/1N2O1kGgIJ0t6h3gFL2sLy2uBdIcQnGUd/view?usp=sharing

@dlsrb6342
Copy link
Member

I tested with following build.gradle and it works well. I think you need to check your multi modules project's setting.

plugins {
	id 'org.springframework.boot' version '2.2.7.RELEASE'
	id 'io.spring.dependency-management' version '1.0.9.RELEASE'
	id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-actuator'
	implementation 'org.springframework.boot:spring-boot-starter-webflux'
	implementation 'io.github.resilience4j:resilience4j-spring-boot2:1.4.0'
	implementation 'io.micrometer:micrometer-registry-prometheus'

	testImplementation('org.springframework.boot:spring-boot-starter-test') {
		exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
	}
	testImplementation 'io.projectreactor:reactor-test'
}

test {
	useJUnitPlatform()
}

@esteve8
Copy link
Author

esteve8 commented Jul 3, 2020

thanks! i'm gonna check :)

@esteve8
Copy link
Author

esteve8 commented Jul 3, 2020

One question, if i don't add:

implementation ("io.github.resilience4j:resilience4j-circuitbreaker:1.4.0")
implementation ("io.github.resilience4j:resilience4j-timelimiter:1.4.0")

I got this error:

The method's class, io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry, is available from the following locations:

jar:file:/opt/playspace/mc-collections.jar!/BOOT-INF/lib/resilience4j-circuitbreaker-1.1.0.jar!/io/github/resilience4j/circuitbreaker/CircuitBreakerRegistry.class

@RobWin
Copy link
Member

RobWin commented Jul 3, 2020

I guess you have a dependency to the Spring Cloud Dependency pom?
They are still using an old version of resilience4j in Spring Cloud Circuitbreaker

@esteve8
Copy link
Author

esteve8 commented Jul 3, 2020

Yes,

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR4"
}
}

Maybe thats the reason because i have so many problems? what is your recommendation, exclude the circuit breaker dependencies from org.springframework.cloud:spring-cloud-dependencies?

@esteve8
Copy link
Author

esteve8 commented Jul 3, 2020

these are my libs

image

@esteve8
Copy link
Author

esteve8 commented Jul 6, 2020

Hello! do you have any idea how to fix it @RobWin @dlsrb6342 ?

@Romeh
Copy link
Member

Romeh commented Jul 6, 2020

@esteve8
spring cloud circuit breaker are not using 1.4.0 or latest 1.5.0 , they open issue now for that spring-cloud/spring-cloud-circuitbreaker#73 which originally came from my issue to upgrade to 1.4.0

So in in your dependency management of the spring cloud , u need to set implicitly the resilience4j version u will use temporary till they do it in their side , example in maven :

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- till spring cloud team release next version which has the updated resilience4j version-->
            <dependency>
                <groupId>io.github.resilience4j</groupId>
                <artifactId>resilience4j-circuitbreaker</artifactId>
                <version>1.4.0</version>
            </dependency>
            <dependency>
                <groupId>io.github.resilience4j</groupId>
                <artifactId>resilience4j-timelimiter</artifactId>
                <version>1.4.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

@esteve8
Copy link
Author

esteve8 commented Jul 7, 2020

ahh makes sense! i will try your solution, thaks so much! @Romeh

@esteve8
Copy link
Author

esteve8 commented Jul 13, 2020

Hello again @Romeh

I tried to put:

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$project.version_spring_cloud"
}
dependencies {
dependency 'io.github.resilience4j:resilience4j-circuitbreaker:1.4.0'
dependency 'io.github.resilience4j:resilience4j-timelimiter:1.4.0'
}
}

with this dependences:

implementation ("io.github.resilience4j:resilience4j-spring-boot2:1.5.0")
implementation ("org.springframework.boot:spring-boot-starter-aop")
implementation ("io.github.resilience4j:resilience4j-circuitbreaker:1.4.0")
implementation ("io.github.resilience4j:resilience4j-timelimiter:1.4.0")
implementation ("io.github.resilience4j:resilience4j-micrometer:1.4.0")
implementation ("io.micrometer:micrometer-registry-prometheus")

But i still got this error:

Parameter 2 of method circuitBreakersHealthIndicator in io.github.resilience4j.circuitbreaker.autoconfigure.CircuitBreakersHealthIndicatorAutoConfiguration required a bean of type 'org.springframework.boot.actuate.health.StatusAggregator' that could not be found.

Action:

Consider defining a bean of type 'org.springframework.boot.actuate.health.StatusAggregator' in your configuration.

Any idea will be appreciated

@Romeh
Copy link
Member

Romeh commented Jul 13, 2020

@esteve8 can u please check out that sample and compare with ur setup ?
https://github.com/Romeh/spring-cloud-gateway-resilience4j

@esteve8
Copy link
Author

esteve8 commented Jul 13, 2020

I compared but i can't see relevant diffs, do you know what lib or class i need for fix the error? why this error happens? @Romeh

@Romeh
Copy link
Member

Romeh commented Jul 14, 2020

@esteve8 can u share your gradle build file for review ?

meanwhile u do not need to define twice :
implementation ("io.github.resilience4j:resilience4j-circuitbreaker:1.4.0")
implementation ("io.github.resilience4j:resilience4j-timelimiter:1.4.0")

it comes transitively from spring cloud with the version ur override there.

Also i see u mix 1.5 with 1.4 in ur dependencies :
implementation ("io.github.resilience4j:resilience4j-spring-boot2:1.5.0")

@esteve8
Copy link
Author

esteve8 commented Jul 14, 2020

Hi @Romeh

I uploaded for you the build.gradle to my drive account: https://drive.google.com/file/d/1R4UN57xedbRcw0ge0bqnog-LYUoymV_R/view?usp=sharing

Do you see any mistake?

Thanks so much for your help

@esteve8
Copy link
Author

esteve8 commented Jul 14, 2020

@esteve8 can u share your gradle build file for review ?

meanwhile u do not need to define twice :
implementation ("io.github.resilience4j:resilience4j-circuitbreaker:1.4.0")
implementation ("io.github.resilience4j:resilience4j-timelimiter:1.4.0")

it comes transitively from spring cloud with the version ur override there.

Also i see u mix 1.5 with 1.4 in ur dependencies :
implementation ("io.github.resilience4j:resilience4j-spring-boot2:1.5.0")

If i don't put the 1.4, by default gets me de 1.1 and it's too old.. I updated to 1.5 all the dependencies but i still have the same error.

@RobWin RobWin closed this as completed Jan 7, 2021
@heowc
Copy link

heowc commented Oct 29, 2021

I got this same error in the following versions.

  • spring boot version = 2.4.1
  • resilience4j version = 1.7.1

However, it was solved by adding the following option:

management.endpoint.health.enabled=true

@kas-kad
Copy link

kas-kad commented Mar 19, 2022

'org.springframework.boot.actuate.health.StatusAggregator' that could not be found.

I had the same problem. Whatever versions combination I tried for spring boot and resilience4j - had no luck until finally I removed this property:

management.health.circuitbreakers.enabled: true

so now I reached my goal to have actuator/circuitbreakerevents edpoint working, but now I have my actuator/health returning 404... which is tolerable
I'm on SB 2.4.4 + resilience4j 1.6.1 now

@maheshsaini89
Copy link

I also facing a similar problem with Resilience4j 1.7.1

Parameter 2 of method circuitBreakersHealthIndicator in io.github.resilience4j.circuitbreaker.autoconfigure.CircuitBreakersHealthIndicatorAutoConfiguration required a bean of type 'org.springframework.boot.actuate.health.StatusAggregator' that could not be found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants