Skip to content

Commit e9836fb

Browse files
author
Bhumika Sharma
committed
Fix: tag name and adds lagging reason
Signed-off-by: Bhumika Sharma <bhumikka@amazon.com>
1 parent a32a4c1 commit e9836fb

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
public final class ClusterManagerMetrics {
2525

26-
public static final String NODE_ID_TAG = "follower_node_id";
26+
public static final String FOLLOWER_NODE_ID_TAG = "follower_node_id";
2727
public static final String REASON_TAG = "reason";
2828
private static final String LATENCY_METRIC_UNIT_MS = "ms";
2929
private static final String COUNTER_METRICS_UNIT = "1";

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@
112112
import java.util.stream.Stream;
113113
import java.util.stream.StreamSupport;
114114

115-
import static org.opensearch.cluster.ClusterManagerMetrics.NODE_ID_TAG;
115+
import static org.opensearch.cluster.ClusterManagerMetrics.FOLLOWER_NODE_ID_TAG;
116116
import static org.opensearch.cluster.ClusterManagerMetrics.REASON_TAG;
117117
import static org.opensearch.cluster.coordination.FollowersChecker.NODE_LEFT_REASON_DISCONNECTED;
118118
import static org.opensearch.cluster.coordination.FollowersChecker.NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL;
119119
import static org.opensearch.cluster.coordination.FollowersChecker.NODE_LEFT_REASON_HEALTHCHECK_FAIL;
120+
import static org.opensearch.cluster.coordination.FollowersChecker.NODE_LEFT_REASON_LAGGING;
120121
import static org.opensearch.cluster.coordination.NoClusterManagerBlockService.NO_CLUSTER_MANAGER_BLOCK_ID;
121122
import static org.opensearch.cluster.decommission.DecommissionHelper.nodeCommissioned;
122123
import static org.opensearch.gateway.ClusterStateUpdaters.hideStateIfNotRecovered;
@@ -369,14 +370,15 @@ private void removeNode(DiscoveryNode discoveryNode, String reason) {
369370
);
370371
String reasonToPublish = switch (reason) {
371372
case NODE_LEFT_REASON_DISCONNECTED -> "disconnected";
373+
case NODE_LEFT_REASON_LAGGING -> "lagging";
372374
case NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL -> "follower.check.fail";
373375
case NODE_LEFT_REASON_HEALTHCHECK_FAIL -> "health.check.fail";
374376
default -> reason;
375377
};
376378
clusterManagerMetrics.incrementCounter(
377379
clusterManagerMetrics.nodeLeftCounter,
378380
1.0,
379-
Optional.ofNullable(Tags.create().addTag(NODE_ID_TAG, discoveryNode.getId()).addTag(REASON_TAG, reasonToPublish))
381+
Optional.ofNullable(Tags.create().addTag(FOLLOWER_NODE_ID_TAG, discoveryNode.getId()).addTag(REASON_TAG, reasonToPublish))
380382
);
381383
}
382384
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public class FollowersChecker {
8686
private static final Logger logger = LogManager.getLogger(FollowersChecker.class);
8787

8888
public static final String FOLLOWER_CHECK_ACTION_NAME = "internal:coordination/fault_detection/follower_check";
89+
public static final String NODE_LEFT_REASON_LAGGING = "lagging";
8990
public static final String NODE_LEFT_REASON_DISCONNECTED = "disconnected";
9091
public static final String NODE_LEFT_REASON_HEALTHCHECK_FAIL = "health check failed";
9192
public static final String NODE_LEFT_REASON_FOLLOWER_CHECK_RETRY_FAIL = "followers check retry count exceeded";

0 commit comments

Comments
 (0)