79561025

Date: 2025-04-08 01:54:53
Score: 0.5
Natty:
Report link

Why not use `spring-boot-starter-actuator` dependency? That will give you the option of exposing plenty of endpoints.

As for `prometheus`, you will have to use `io.micrometer:micrometer-registry-prometheus` dependency in addition to enable `/actuator/prometheus`. It is plug-and-play so it will start exposing your jvm metrics.

The following config must be added in the base `application.yml` of the spring-boot service:

management:
  endpoints:
    web:
      exposure:
        include: * # health,prometheus
    health:
      show-details: always

You can be more granular on what endpoints you want to expose by replacing the * with something more specific as per Spring's doco: Endpoints :: Spring Boot

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): Why not use
  • Low reputation (0.5):
Posted by: John Chan