From 38b99a42a0f7d3a628a76c32f523020bcceb1f7a Mon Sep 17 00:00:00 2001 From: jmulcahy Date: Wed, 14 Oct 2020 14:30:43 -0700 Subject: [PATCH] Add a metric to report selfPreservationMode --- .../eureka/registry/PeerAwareInstanceRegistryImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java b/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java index 73dce9029d..1bfd39bc91 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java +++ b/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java @@ -512,6 +512,11 @@ public boolean isSelfPreservationModeEnabled() { return serverConfig.shouldEnableSelfPreservation(); } + @com.netflix.servo.annotations.Monitor(name = METRIC_REGISTRY_PREFIX + "isSelfPreservationModeEnabled", type = DataSourceType.GAUGE) + public int isSelfPreservationModeEnabledMetric() { + return isSelfPreservationModeEnabled() ? 1 : 0; + } + @Override public InstanceInfo getNextServerFromEureka(String virtualHostname, boolean secure) { // TODO Auto-generated method stub