Prometheus Endpoint Not Working Spring Boot 2.0.0.RC1 Spring Webflux enabled

A bit late - but just for the record - I can verify that this works now in 2.0.0.RELEASE.

Dependencies (gradle):

compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('io.micrometer:micrometer-registry-prometheus')

application.yaml (reference)

management:
  endpoints:
    web:
      exposure:
        include: health,info,prometheus

I also tested with RC1 - the prometheus endpoint does not show up for some reason - just as @ROCKY explained.


spring boot does not expose prometheus endpoint by default even if you have >micrometer-registry-prometheus in you classpath.

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

you need to explicit tell spring boot to expose prometheus endpoint by below property.

management.endpoints.web.exposure.include=health,info,metrics,prometheus


There's some things you could check:

  1. Have you added the necessary MeterRegistry implementation so that the Prometheus "subsystem" of the Micrometer instrumentation library is present? (The Micrometer library is powering the Actuator implementation as of Spring Boot 2.0)

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

    Without a specific MeterRegistry implementation you just end up with the regular /actuator/metrics endpoint powered by the SimpleMeterRegistry implementation.

  2. Have you actually placed the mentioned properties in a application.[yml,yaml] file instead of application.properties? (I just stumbled upon the same with a fresh demo project generated with Spring Initializr.)


I experienced the same problem and managed to fix it by adding "include" tag into the configuration:

management:
  metrics:
    export:
      prometheus:
        enabled: true
  endpoints:
    web:
      exposure:
        include: prometheus,info,metrics,threaddump