0
votes

SpringBoot v2.5.1

I would like to have all actuator endpoints (described in documentation) available. Following the docs, have added actuator starter dependency and a property, but most of the endpoints are not available (HTTP 404).

The only available endpoint is GET /actuator/health, but it shows useless info: {"status": "UP"}

Added property management.endpoints.enabled-by-default=true.

Added dependency:

 <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-actuator</artifactId>
 </dependency>

Result of GET /actuator

{
    "_links": {
        "self": {
            "href": "http://localhost:9999/actuator",
            "templated": false
        },
        "health-path": {
            "href": "http://localhost:9999/actuator/health/{*path}",
            "templated": true
        },
        "health": {
            "href": "http://localhost:9999/actuator/health",
            "templated": false
        }
    }
}

What is the minimal set up to enable actuator endpoints?

1

1 Answers

0
votes

Add micrometer-core and micrometer-registry-prometheus dependencies in your pom.xml file:

<!-- Spring boot actuator to expose metrics endpoint -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<!-- Micormeter core dependecy -->
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-core</artifactId>
</dependency>

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

Add below properties in your application.properties file:

#Metrics related configurations
management.endpoint.metrics.enabled          = true
management.endpoints.web.exposure.include    = *
management.endpoint.prometheus.enabled       = true
management.metrics.export.prometheus.enabled = true

If you need to expose everything over HTTP then you need to set management.endpoints.web.exposure.include as shown in above example. In your code this property is missing. Please refer spring docs if you wish to expose specific endpoints. I have also added dependencies in above examples which are required to expose prometheus related endpoints.