Skip to content

Commit 28f7304

Browse files
authored
server: Adds metrics for background defrag task (#5767)
Note: metrics are not added for the manual execution of the task in this PR Signed-off-by: Abhijat Malviya <[email protected]>
1 parent 28ee7f3 commit 28f7304

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/server/server_family.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,14 @@ void PrintPrometheusMetrics(uint64_t uptime, const Metrics& m, DflyCmd* dfly_cmd
19101910

19111911
absl::StrAppend(&resp->body(), db_key_metrics, db_key_expire_metrics, db_capacity_metrics,
19121912
memory_by_class_bytes);
1913+
1914+
AppendMetricHeader("defrag_stats", "Stats for defragmentation task", COUNTER, &resp->body());
1915+
AppendMetricWithoutLabels("defrag_invocations", "Defrag invocations",
1916+
m.shard_stats.defrag_task_invocation_total, COUNTER, &resp->body());
1917+
AppendMetricWithoutLabels("defrag_attempts", "Objects examined",
1918+
m.shard_stats.defrag_attempt_total, COUNTER, &resp->body());
1919+
AppendMetricWithoutLabels("defrag_invocations", "Objects moved",
1920+
m.shard_stats.defrag_realloc_total, COUNTER, &resp->body());
19131921
}
19141922

19151923
void ServerFamily::ConfigureMetrics(util::HttpListenerBase* http_base) {

0 commit comments

Comments
 (0)