Skip to content

Commit

Permalink
Merge pull request #241 from Snapchat/improve-insufficient-replica-alarm
Browse files Browse the repository at this point in the history
update insufficient replicas metrics to separate severity
  • Loading branch information
zliang-sc authored and GitHub Enterprise committed Nov 28, 2023
2 parents 8a5857d + 18d6241 commit deb139e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 10 additions & 0 deletions ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ on:
# references a build defined in build.yaml
build_name: keydb-docker-build
arch_types: ["amd64", "arm64"]
# Doc: go/cool-guide
cool:
workflows:
- workflow_type: backend_workflow
build_name: keydb-build
arch_types: ["amd64", "arm64"]
- workflow_type: backend_workflow
# references a build defined in build.yaml
build_name: keydb-docker-build
arch_types: ["amd64", "arm64"]

# below defines which branch is release branch / release tag
machamp:
Expand Down
8 changes: 2 additions & 6 deletions src/modules/keydb_modstatsd/modmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class StatsdClientWrapper

/* constants */
static time_t c_infoUpdateSeconds = 10;
// 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
static const int EXPECTED_NUMBER_OF_REPLICAS = 2;

StatsdClientWrapper *g_stats = nullptr;
std::string m_strPrefix { "keydb" };
Expand Down Expand Up @@ -567,10 +565,8 @@ void emit_metrics_for_insufficient_replicas(struct RedisModuleCtx *ctx, long lon
// check if the current node is a primary
if (strncmp(role, "master", len) == 0) {
RedisModuleCallReply *replicasReply = RedisModule_CallReplyArrayElement(reply, 2);
// check if there are less than 2 connected replicas
if (RedisModule_CallReplyLength(replicasReply) < EXPECTED_NUMBER_OF_REPLICAS) {
g_stats->increment("lessThanExpectedReplicas_error", 1);
}
size_t numberOfActiveReplicas = RedisModule_CallReplyLength(replicasReply);
g_stats->gauge("numberOfActiveReplicas", numberOfActiveReplicas);
}
RedisModule_FreeCallReply(reply);
}
Expand Down

0 comments on commit deb139e

Please sign in to comment.