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

ROCKY picture ROCKY · Feb 4, 2018 · Viewed 9.8k times · Source

I followed the documentation here (https://docs.spring.io/spring-boot/docs/2.0.0.RC1/reference/htmlsingle/#production-ready-endpoints-enabling-endpoints) and made sure application.yml file has the below

management:
  metrics:
    export:
      prometheus:
        enabled: true
  endpoints:
    web:
      expose:
        health, info, httptrace, metrics, threaddump, mappings, prometheus

As per the documentation (https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/actuator-api/html/#prometheus) the following doesn't work.

curl 'http://localhost:8080/actuator/prometheus' -i

I get 404 Handler mapping not found exception. Can someone please let me know how to enable prometheus endpoint for scraping purposes and what URL endpoint I need to use to test it out?

o.s.w.r.r.m.a.RequestMappingHandlerMapping[276] - Did not find handler method for [/actuator/prometheus]

All other endpoints health, info, httptrace, threaddump, mappings are working perfectly fine.

Answer

Lachezar Balev picture Lachezar Balev · Apr 4, 2018

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.