From 20ae39d643c6fed65284ef8b3002e99d573da624 Mon Sep 17 00:00:00 2001 From: zliang Date: Mon, 27 Nov 2023 13:38:43 -0700 Subject: [PATCH 1/3] update insufficient replicas metrics to separate severity --- src/modules/keydb_modstatsd/modmain.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/keydb_modstatsd/modmain.cpp b/src/modules/keydb_modstatsd/modmain.cpp index 5feafc284..d8de39d92 100644 --- a/src/modules/keydb_modstatsd/modmain.cpp +++ b/src/modules/keydb_modstatsd/modmain.cpp @@ -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" }; @@ -567,8 +565,12 @@ void emit_metrics_for_insufficient_replicas(struct RedisModuleCtx *ctx, long lon 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 numberOfReplicas = RedisModule_CallReplyLength(replicasReply); + if (numberOfReplicas == 0) { + g_stats->increment("lessThanExpectedReplicas_noReplicas_criticalError", 1); + } + else if (numberOfReplicas == 1) { + g_stats->increment("lessThanExpectedReplicas_1ReplicaLeft_error", 1); } } RedisModule_FreeCallReply(reply); From 8fec9ba466a7692c1d11afac579625a2c739301e Mon Sep 17 00:00:00 2001 From: zliang Date: Mon, 27 Nov 2023 17:01:04 -0700 Subject: [PATCH 2/3] emit number of active replicas metrics instead --- src/modules/keydb_modstatsd/modmain.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/modules/keydb_modstatsd/modmain.cpp b/src/modules/keydb_modstatsd/modmain.cpp index d8de39d92..8d30808f1 100644 --- a/src/modules/keydb_modstatsd/modmain.cpp +++ b/src/modules/keydb_modstatsd/modmain.cpp @@ -564,14 +564,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 - size_t numberOfReplicas = RedisModule_CallReplyLength(replicasReply); - if (numberOfReplicas == 0) { - g_stats->increment("lessThanExpectedReplicas_noReplicas_criticalError", 1); - } - else if (numberOfReplicas == 1) { - g_stats->increment("lessThanExpectedReplicas_1ReplicaLeft_error", 1); - } + size_t numberOfActiveReplicas = RedisModule_CallReplyLength(replicasReply); + g_stats->gauge("numberOfActiveReplicas", numberOfActiveReplicas); } RedisModule_FreeCallReply(reply); } From 443e1afe89aa415ff3e3c48496f20b17a86e7c45 Mon Sep 17 00:00:00 2001 From: zliang Date: Mon, 27 Nov 2023 17:50:06 -0700 Subject: [PATCH 3/3] add cool --- ci.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ci.yaml b/ci.yaml index 595d23239..7b885cacd 100644 --- a/ci.yaml +++ b/ci.yaml @@ -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: