-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Some metrics are lost when Spring Data is on the classpath #26630
Comments
I'm also having this problem. This seems to be a recurring issue, described here: The solution below seems to fix it (from https://stackoverflow.com/a/57908577/7995881): @Configuration
public class ActuatorMetricsConfig {
@Bean
InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor, PrometheusMeterRegistry registry) {
return () -> meterRegistryPostProcessor.postProcessAfterInitialization(registry, "");
}
} |
Thanks for the sample, @knoobie. The problem's due to some premature initialisation of the
I'd like these warnings to be more prominent. In this case they're caused by a change in Boot 2.5 which we'll fix. In the meantime, you can add the following bean to improve the situation:
The |
Another workaround I found while fixing our application. Excluding With the |
@wilkinsona adding the bean suggested by you is failing the application to run. The repo beans are throwing NPE while building spring context. Getting exception of BeanCreationException: Invocation of init method failed, nested exception is NPE: cannot read the array length because "" is null. I am invoking the repo.findAll() method inside @PostConstruct method of a spring bean. |
@sanjayrawat1 this issue is closed now and that NPE doesn't seem related to the task at hand. If you think you've found a bug in Spring Boot, please create a separate issue with a small sample we can run that reproduces the problem. You may also want to try |
Hello
The following method does not solve the problem, what is your reason?
|
Description
Including
spring-boot-starter-data-jpa
to the classpath results in a lot of missing metrics for the application.Guess: Looks like part of my configuration isn't applied - see e.g.
XActuatorTest::testDisabledMetricsShouldNotBePresent
and the disabled property in myapplication.yml
.Example
XActuatorTest
The problem did not occur with Spring Boot 2.4.5 or without
spring-boot-starter-data-jpa
. Downgrading to 2.4.5 or removingspring-boot-starter-data-jpa
changes all test from fail to success.Edit: This problem does not only occur in test, running the application normally as well.
The text was updated successfully, but these errors were encountered: