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

Metrics are missing "jvm_*" if "@EnableGlobalMethodSecurity" is used #26684

Closed
lathspell opened this issue May 27, 2021 · 9 comments
Closed

Metrics are missing "jvm_*" if "@EnableGlobalMethodSecurity" is used #26684

lathspell opened this issue May 27, 2021 · 9 comments
Labels
status: duplicate A duplicate of another issue

Comments

@lathspell
Copy link
Contributor

lathspell commented May 27, 2021

After upgrading from SpringBoot 2.4.x to SpringBoot 2.5.0, I noticed that all the "jvm_" metrics are missing from the "/actuator/prometheus" output. Other metrics like "tomcat_", "hikari_*" and my custom ones were still present.

In https://stackoverflow.com/questions/57607445/spring-actuator-jvm-metrics-not-showing-when-globalmethodsecurity-is-enabled it was suggested that the problem might be cause by enabling "@EnableGlobalMethodSecurity" which I happen to use in this project.

The below quoted workaround did indeed fix the problem for me:

@Configuration
public class ActuatorMetricsConfig {

    @Bean
    InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor, PrometheusMeterRegistry registry) {
        return () -> meterRegistryPostProcessor.postProcessAfterInitialization(registry, "");
    }

}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 27, 2021
@snicoll
Copy link
Member

snicoll commented May 27, 2021

Thanks for the report. I can't say for sure as you haven't shared a sample but there was a regression in that area that was fixed in 2.5.1-SNAPSHOT. Can you please test with the snapshot? If that still doesn't work, we'll need a small sample that reproduces the problem (as a zip attached to this issue or a link to a GitHub repository).

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label May 27, 2021
@silver-mx
Copy link

I am using the /metrics actuator endpoint and I can also see that the following metrics are not present in 2.5.0 and were in 2.4.6.

NOTE: I am using @EnableGlobalMethodSecurity as well.

"jvm.buffer.count",
"jvm.buffer.memory.used",
"jvm.buffer.total.capacity",
"jvm.classes.loaded",
"jvm.classes.unloaded",
"jvm.gc.live.data.size",
"jvm.gc.max.data.size",
"jvm.gc.memory.allocated",
"jvm.gc.memory.promoted",
"jvm.gc.pause",
"jvm.memory.committed",
"jvm.memory.max",
"jvm.memory.used",
"jvm.threads.daemon",
"jvm.threads.live",
"jvm.threads.peak",
"jvm.threads.states",
"logback.events",
"process.cpu.usage",
"process.files.max",
"process.files.open",
"process.start.time",
"process.uptime",
"system.cpu.count",
"system.cpu.usage",
"system.load.average.1m",

I could not try with 2.5.1-SNAPSHOT as maven did not find it, in which maven public repo is that available?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 27, 2021
@snicoll
Copy link
Member

snicoll commented May 27, 2021

I could not try with 2.5.1-SNAPSHOT as maven did not find it, in which maven public repo is that available?

Please explore a project on start.spring.io using 2.5.1-SNAPSHOT and it'll show you how to setup your build (repo.spring.io/snapshot).

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 27, 2021
@silver-mx
Copy link

silver-mx commented May 28, 2021

Yes, I tried 2.5.1-SNAPSHOT, and all the metrics that existed in 2.4.6 + spring.data.repository.invocations are now present in 2.5.1-SNAPSHOT. So it looks like the problem has been fixed. Thanks!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 28, 2021
@snicoll
Copy link
Member

snicoll commented May 28, 2021

@silver-mx alright, another problem then. Can you please share a small sample that reproduces the problem? You can attach the zip here or share a link to a GitHub repo.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 28, 2021
@silver-mx
Copy link

Just to be sure. As I mentioned, the reported problem is fixed in the version 2.5.1-SNAPSHOTbut you still need a sample that reproduces the issue right?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 28, 2021
@snicoll
Copy link
Member

snicoll commented May 28, 2021

Ah sorry, more coffee needed here! I read your feedback backwards. Thanks for confirming that 2.5.1-SNAPSHOT fixes the problem (with is more aligned with what I was expecting).

@lathspell can you please try with 2.5.1-SNAPSHOT on your project as well to make sure it isn't a separate problem?

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 28, 2021
dagbjorn added a commit to dagbjorn/microcoffeeoncloud that referenced this issue May 30, 2021
…3, java-jwt 3.15.0 -> 3.16.0, modelmapper 2.4.0 -> 2.4.4 and bootstrap 4.6.0-1 -> 5.0.1.

Upgraded Docker images jboss/keycloak 13.0.0 -> 13.0.1, openjdk 11.0.10-slim -> 11.0.11-slim and mongo 4.4.5 -> 4.4.6.

Fixed upgrade issues: 1) Missing resilience4j metrics (spring-projects/spring-boot#26684) Fixed in 2.5.1. Use 2.5.1-SNAPSHOT meanwhile. (Needs https://repo.spring.io/snapshot repositories.) 2) WireMock stubbing of OIDC provider JWKS API must be moved from @beforeeach to @BeforeAll method. 3) Replace deprecated ClientAuthenticationMethod.BASIC by ClientAuthenticationMethod.CLIENT_SECRET_BASIC.
@lathspell
Copy link
Contributor Author

I can confirm that 2.5.1-SNAPSHOT fixes the problem. I now see 48 metrics starting with "jvm" again.

@snicoll
Copy link
Member

snicoll commented May 31, 2021

Brilliant. Thanks for testing the snapshot @lathspell!

Closing as a duplicate of #26630

@snicoll snicoll closed this as completed May 31, 2021
@snicoll snicoll added status: duplicate A duplicate of another issue and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

4 participants