I’m using a Spring Boot project with version2.5.6 and springfox-boot-starter version 3.0.0. My project also includes a WebSecurityConfig class that extends WebSecurityConfigurerAdapter and implements WebMvcConfigurer. However, I’m facing an issue where the metric jvm_memory_usage_after_gc_percent is not visible in the /actuator/metrics endpoint.

We also cannot remove springfox-boot-starter because we would need swagger in our application.

To enable the jvm_memory_usage_after_gc_percent metric in the /actuator/metrics endpoint, I tried adding the following dependencies:

<dependency>             
    <groupId>io.micrometer</groupId>             
    <artifactId>micrometer-registry-prometheus</artifactId>         
</dependency>         
<dependency>            
    <groupId>io.micrometer</groupId>             
    <artifactId>micrometer-core</artifactId>         
</dependency>

I also updated my application.yml configuration as:

management:
    metrics:
        enable:
            jvm: true
            all: true
        export:
            prometheus:
                enabled: true
    endpoints:
        web:
            exposure:
                include: "*"
            cors:
                allowed-methods: GET,POST
                allowed-origins: ${ALLOWED_ORIGINS:https://abc-xyz.rst.net
    endpoint:
        shutdown:
            enabled: true
        metrics:
            enabled: true
springfox:
    documentation:
        swagger-ui:
            enabled: true
        security:
            enabled: true

Despite these changes, the jvm_memory_usage_after_gc_percent metric is still not visible. Is there anything I’m missing in my configuration or setup?

Comment From: bclozel

Hello @Tanu-Shree-31 and thanks for reaching out.

Unfortunately Spring Boot 2.5 is both out of OSS and commercial support so we can't really help you here. It seems springfox is not maintained anymore. I would suggest upgrading to a supported version as soon as possible.