Skip to content

Commit 21b19e9

Browse files
Yomanzromange
authored andcommitted
fix(metrics): add corresponding comments to command metrics (#4674)
--------- Signed-off-by: Lewis <lewis@ourzora.com>
1 parent 4f91030 commit 21b19e9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/server/server_family.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,15 +1447,21 @@ void PrintPrometheusMetrics(uint64_t uptime, const Metrics& m, DflyCmd* dfly_cmd
14471447
if (!m.cmd_stats_map.empty()) {
14481448
string command_metrics;
14491449

1450-
AppendMetricHeader("commands", "Metrics for all commands ran", MetricType::COUNTER,
1450+
AppendMetricHeader("commands_total", "Total number of commands executed", MetricType::COUNTER,
14511451
&command_metrics);
14521452
for (const auto& [name, stat] : m.cmd_stats_map) {
14531453
const auto calls = stat.first;
1454-
const double duration_seconds = stat.second * 1e-6;
14551454
AppendMetricValue("commands_total", calls, {"cmd"}, {name}, &command_metrics);
1455+
}
1456+
1457+
AppendMetricHeader("commands_duration_seconds", "Duration of commands in seconds",
1458+
MetricType::HISTOGRAM, &command_metrics);
1459+
for (const auto& [name, stat] : m.cmd_stats_map) {
1460+
const double duration_seconds = stat.second * 1e-6;
14561461
AppendMetricValue("commands_duration_seconds", duration_seconds, {"cmd"}, {name},
14571462
&command_metrics);
14581463
}
1464+
14591465
absl::StrAppend(&resp->body(), command_metrics);
14601466
}
14611467

0 commit comments

Comments
 (0)