Skip to content

Commit c3ad4a8

Browse files
committed
Minor fixes
Signed-off-by: Arpit Patawat <[email protected]>
1 parent 8de972a commit c3ad4a8

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

server/src/main/java/org/opensearch/cluster/ClusterManagerMetrics.java

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
public final class ClusterManagerMetrics {
2525

2626
public static final String NODE_ID_TAG = "node_id";
27+
public static final String REASON_TAG = "reason";
2728
private static final String LATENCY_METRIC_UNIT_MS = "ms";
2829
private static final String COUNTER_METRICS_UNIT = "1";
2930

server/src/main/java/org/opensearch/cluster/coordination/Coordinator.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@
113113
import java.util.stream.StreamSupport;
114114

115115
import static org.opensearch.cluster.ClusterManagerMetrics.NODE_ID_TAG;
116+
import static org.opensearch.cluster.ClusterManagerMetrics.REASON_TAG;
117+
import static org.opensearch.cluster.coordination.FollowersChecker.NODE_LEFT_REASON_DISCONNECTED;
118+
import static org.opensearch.cluster.coordination.FollowersChecker.NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL;
119+
import static org.opensearch.cluster.coordination.FollowersChecker.NODE_LEFT_REASON_HEALTHCHECK_FAIL;
120+
import static org.opensearch.cluster.coordination.FollowersChecker.NODE_LEFT_REASON_LAGGING;
116121
import static org.opensearch.cluster.coordination.NoClusterManagerBlockService.NO_CLUSTER_MANAGER_BLOCK_ID;
117122
import static org.opensearch.cluster.decommission.DecommissionHelper.nodeCommissioned;
118123
import static org.opensearch.gateway.ClusterStateUpdaters.hideStateIfNotRecovered;
@@ -129,11 +134,6 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery
129134
public static final long ZEN1_BWC_TERM = 0;
130135

131136
private static final Logger logger = LogManager.getLogger(Coordinator.class);
132-
public static final String NODE_LEFT_REASON_LAGGING = "lagging";
133-
public static final String NODE_LEFT_REASON_DISCONNECTED = "disconnected";
134-
public static final String NODE_LEFT_REASON_HEALTHCHECK_FAIL = "health check failed";
135-
public static final String NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL = "followers check retry count exceeded";
136-
private static final String REASON_TAG = "Reason";
137137

138138
// the timeout before emitting an info log about a slow-running publication
139139
public static final Setting<TimeValue> PUBLISH_INFO_TIMEOUT_SETTING = Setting.timeSetting(
@@ -372,8 +372,8 @@ private void removeNode(DiscoveryNode discoveryNode, String reason) {
372372
String reasonToPublish = switch (reason) {
373373
case NODE_LEFT_REASON_DISCONNECTED -> "disconnected";
374374
case NODE_LEFT_REASON_LAGGING -> "lagging";
375-
case NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL -> "followerCheckFail";
376-
case NODE_LEFT_REASON_HEALTHCHECK_FAIL -> "healthCheckFail";
375+
case NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL -> "follower.check.fail";
376+
case NODE_LEFT_REASON_HEALTHCHECK_FAIL -> "health.check.fail";
377377
default -> reason;
378378
};
379379
clusterManagerMetrics.incrementCounter(

server/src/main/java/org/opensearch/cluster/coordination/FollowersChecker.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@
7070
import java.util.function.Consumer;
7171
import java.util.function.Predicate;
7272

73-
import static org.opensearch.cluster.coordination.Coordinator.NODE_LEFT_REASON_DISCONNECTED;
74-
import static org.opensearch.cluster.coordination.Coordinator.NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL;
75-
import static org.opensearch.cluster.coordination.Coordinator.NODE_LEFT_REASON_HEALTHCHECK_FAIL;
7673
import static org.opensearch.common.util.concurrent.ConcurrentCollections.newConcurrentMap;
7774
import static org.opensearch.monitor.StatusInfo.Status.UNHEALTHY;
7875

@@ -89,6 +86,10 @@ public class FollowersChecker {
8986
private static final Logger logger = LogManager.getLogger(FollowersChecker.class);
9087

9188
public static final String FOLLOWER_CHECK_ACTION_NAME = "internal:coordination/fault_detection/follower_check";
89+
public static final String NODE_LEFT_REASON_LAGGING = "lagging";
90+
public static final String NODE_LEFT_REASON_DISCONNECTED = "disconnected";
91+
public static final String NODE_LEFT_REASON_HEALTHCHECK_FAIL = "health check failed";
92+
public static final String NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL = "followers check retry count exceeded";
9293

9394
// the time between checks sent to each node
9495
public static final Setting<TimeValue> FOLLOWER_CHECK_INTERVAL_SETTING = Setting.timeSetting(

0 commit comments

Comments
 (0)