Skip to content

Commit a7f358e

Browse files
authored
feat(tiering): Basic metrics (#6086)
1 parent ad51e9d commit a7f358e

File tree

2 files changed

+441
-0
lines changed

2 files changed

+441
-0
lines changed

src/server/server_family.cc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,9 @@ void PrintPrometheusMetrics(uint64_t uptime, const Metrics& m, DflyCmd* dfly_cmd
18101810
AppendMetricValue("memory_by_class_bytes", m.coordinator_stats.stored_cmd_bytes, {"class"},
18111811
{"conn_stored_commands"}, &memory_by_class_bytes);
18121812

1813+
AppendMetricValue("memory_by_class_bytes", m.search_stats.used_memory, {"class"}, {"search_used"},
1814+
&memory_by_class_bytes);
1815+
18131816
// Command stats
18141817
if (!m.cmd_stats_map.empty()) {
18151818
string command_metrics;
@@ -1955,6 +1958,49 @@ void PrintPrometheusMetrics(uint64_t uptime, const Metrics& m, DflyCmd* dfly_cmd
19551958
m.shard_stats.defrag_attempt_total, COUNTER, &resp->body());
19561959
AppendMetricWithoutLabels("defrag_objects_moved", "Objects moved",
19571960
m.shard_stats.defrag_realloc_total, COUNTER, &resp->body());
1961+
1962+
// Tiered metrics
1963+
{
1964+
AppendMetricWithoutLabels("tiered_entries", "Tiered entries", total.tiered_entries,
1965+
MetricType::GAUGE, &resp->body());
1966+
1967+
// Bytes: used, allocated, capacity
1968+
AppendMetricHeader("tiered_bytes", "Tiered bytes", MetricType::GAUGE, &resp->body());
1969+
AppendMetricValue("tiered_bytes", total.tiered_used_bytes, {"type"}, {"used"}, &resp->body());
1970+
AppendMetricValue("tiered_bytes", m.tiered_stats.cold_storage_bytes, {"type"}, {"cold"},
1971+
&resp->body());
1972+
AppendMetricValue("tiered_bytes", m.tiered_stats.allocated_bytes, {"type"}, {"allocated"},
1973+
&resp->body());
1974+
AppendMetricValue("tiered_bytes", m.tiered_stats.capacity_bytes, {"type"}, {"capacity"},
1975+
&resp->body());
1976+
1977+
// Events: stash, fetch, upload, cancel
1978+
AppendMetricHeader("tiered_events", "Tiered events", MetricType::COUNTER, &resp->body());
1979+
AppendMetricValue("tiered_events", m.tiered_stats.total_stashes, {"type"}, {"stash"},
1980+
&resp->body());
1981+
AppendMetricValue("tiered_events", m.tiered_stats.total_fetches, {"type"}, {"fetch"},
1982+
&resp->body());
1983+
AppendMetricValue("tiered_events", m.tiered_stats.total_uploads, {"type"}, {"upload"},
1984+
&resp->body());
1985+
AppendMetricValue("tiered_events", m.tiered_stats.total_cancels, {"type"}, {"cancel"},
1986+
&resp->body());
1987+
AppendMetricValue("tiered_events", m.tiered_stats.total_deletes, {"type"}, {"delete"},
1988+
&resp->body());
1989+
1990+
// Hits: ram, cool, missed
1991+
AppendMetricHeader("tiered_hits", "Tiered hits", MetricType::COUNTER, &resp->body());
1992+
AppendMetricValue("tiered_hits", m.events.ram_hits, {"type"}, {"ram"}, &resp->body());
1993+
AppendMetricValue("tiered_hits", m.events.ram_cool_hits, {"type"}, {"cool"}, &resp->body());
1994+
AppendMetricValue("tiered_hits", m.events.ram_misses, {"type"}, {"disk"}, &resp->body());
1995+
1996+
// Potential problems due to overloading system
1997+
AppendMetricHeader("tiered_overload", "Potential problems due to overlaoding",
1998+
MetricType::COUNTER, &resp->body());
1999+
AppendMetricValue("tiered_overload", m.tiered_stats.total_clients_throttled, {"type"},
2000+
{"client throttling"}, &resp->body());
2001+
AppendMetricValue("tiered_overload", m.tiered_stats.total_stash_overflows, {"type"},
2002+
{"stash overflows"}, &resp->body());
2003+
}
19582004
}
19592005

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

0 commit comments

Comments
 (0)