Package io.camunda.zeebe.util.health
Class DelayedHealthIndicator
java.lang.Object
io.camunda.zeebe.util.health.DelayedHealthIndicator
- All Implemented Interfaces:
org.springframework.boot.actuate.health.HealthContributor,org.springframework.boot.actuate.health.HealthIndicator
public class DelayedHealthIndicator
extends Object
implements org.springframework.boot.actuate.health.HealthIndicator
Wrapper for a health indicator that adds time tolerance to the underlying health indicator. When
the original health indicator reports a
Status.DOWN, then this health indicator will
still report the health status as Status.UP for a certain time. If the health comes back
up during that time, then the downtime will be hidden by the decorator. If the health stays down
for a long time, then this health indicator will also switch to Status.DOWN
Ultimately, the purpose of this class is to implement a health indicator like "no connection to backend for > 5 min of time". In this setup, one needs a "no connection to backend" health indicator that toggles immediately when the connection gets lost. This can then be wrapped in this class to add the delay.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDelayedHealthIndicator(org.springframework.boot.actuate.health.HealthIndicator originalHealthIndicator, Duration maxDowntime) protectedDelayedHealthIndicator(org.springframework.boot.actuate.health.HealthIndicator originalHealthIndicator, Duration maxDowntime, Supplier<Long> clock) Constructor for tests, mainly used to set a different clock -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.actuate.health.HealthIndicator
getHealth
-
Constructor Details
-
DelayedHealthIndicator
protected DelayedHealthIndicator(org.springframework.boot.actuate.health.HealthIndicator originalHealthIndicator, Duration maxDowntime, Supplier<Long> clock) Constructor for tests, mainly used to set a different clock -
DelayedHealthIndicator
public DelayedHealthIndicator(org.springframework.boot.actuate.health.HealthIndicator originalHealthIndicator, Duration maxDowntime)
-
-
Method Details
-
checkHealth
@Scheduled(fixedDelay=5000L) public void checkHealth() -
health
public org.springframework.boot.actuate.health.Health health()- Specified by:
healthin interfaceorg.springframework.boot.actuate.health.HealthIndicator
-