0
votes

I am implementing custom Actuator HealthIndicators for my Spring Boot App.

They look something like:

public class MyClass implements HealthIndicator {

    @Override
    public Health health() {
        LOGGER.info("Checking Service Health...");
        try {
            String url = this.getExternalServiceUrl().concat("/heartbeat");
            JSONObject response = this.getResponse(url, null);
            Boolean responseSuccess = response.getBoolean("success");
            Boolean serviceAvailable = ...

            if (responseSuccess && serviceAvailable) {
                return Health.up().withDetail(...).build();
            } else {
                return Health.down().withDetail(...).build();
            }
        } catch (Exception e) {
            return Health.down().withDetail(...).build();
        }
    }
}

Essentially my app is dependent on other external webservices, and when I call my heartbeat page, i want it to ping the heartbeat of those services, and change my apps UP or DOWN status accordingly.

My question here is, it looks like by default Actuator has a 5 minute or so scheduled time in which it will automatically invoke the /actuator/health endpoint. I want to disable this.

I only want the health endpoint called whenever I explicitly call it in the code.

Does anyone know how to disable Actuators default Scheduling?

Im using spring-boot-actuator:2.1.3.RELEASE

1

1 Answers

1
votes

Spring Boot never automatically calls its own health endpoint. If it is being called every 5 minutes it is something in the environment where you have deployed your application that is doing it.