Skip to content

Commit deb139e

Browse files
zliang-scGitHub Enterprise
authored andcommitted
Merge pull request #241 from Snapchat/improve-insufficient-replica-alarm
update insufficient replicas metrics to separate severity
2 parents 8a5857d + 18d6241 commit deb139e

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

ci.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ on:
2626
# references a build defined in build.yaml
2727
build_name: keydb-docker-build
2828
arch_types: ["amd64", "arm64"]
29+
# Doc: go/cool-guide
30+
cool:
31+
workflows:
32+
- workflow_type: backend_workflow
33+
build_name: keydb-build
34+
arch_types: ["amd64", "arm64"]
35+
- workflow_type: backend_workflow
36+
# references a build defined in build.yaml
37+
build_name: keydb-docker-build
38+
arch_types: ["amd64", "arm64"]
2939

3040
# below defines which branch is release branch / release tag
3141
machamp:

src/modules/keydb_modstatsd/modmain.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ class StatsdClientWrapper
6767

6868
/* constants */
6969
static time_t c_infoUpdateSeconds = 10;
70-
// the current Redis Cluster setup we configure replication factor as 2, each non-empty master node should have 2 replicas, given that there are 3 zones in each regions
71-
static const int EXPECTED_NUMBER_OF_REPLICAS = 2;
7270

7371
StatsdClientWrapper *g_stats = nullptr;
7472
std::string m_strPrefix { "keydb" };
@@ -567,10 +565,8 @@ void emit_metrics_for_insufficient_replicas(struct RedisModuleCtx *ctx, long lon
567565
// check if the current node is a primary
568566
if (strncmp(role, "master", len) == 0) {
569567
RedisModuleCallReply *replicasReply = RedisModule_CallReplyArrayElement(reply, 2);
570-
// check if there are less than 2 connected replicas
571-
if (RedisModule_CallReplyLength(replicasReply) < EXPECTED_NUMBER_OF_REPLICAS) {
572-
g_stats->increment("lessThanExpectedReplicas_error", 1);
573-
}
568+
size_t numberOfActiveReplicas = RedisModule_CallReplyLength(replicasReply);
569+
g_stats->gauge("numberOfActiveReplicas", numberOfActiveReplicas);
574570
}
575571
RedisModule_FreeCallReply(reply);
576572
}

0 commit comments

Comments
 (0)