mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
feat(server): Better reporting of per-type memory in /metrics
(#2303)
This commit is contained in:
parent
e273f7a2b8
commit
4cce3b4a01
1 changed files with 11 additions and 6 deletions
|
@ -878,13 +878,18 @@ void PrintPrometheusMetrics(const Metrics& m, StringResponse* resp) {
|
|||
total += db_stats;
|
||||
}
|
||||
|
||||
for (unsigned type = 0; type < total.memory_usage_by_type.size(); type++) {
|
||||
size_t mem = total.memory_usage_by_type[type];
|
||||
if (mem > 0) {
|
||||
AppendMetricWithoutLabels(
|
||||
absl::StrCat("type_used_memory_", CompactObj::ObjTypeToString(type)), "", mem,
|
||||
MetricType::GAUGE, &resp->body());
|
||||
{
|
||||
string type_used_memory_metric;
|
||||
AppendMetricHeader("type_used_memory", "Memory used per type", MetricType::GAUGE,
|
||||
&type_used_memory_metric);
|
||||
for (unsigned type = 0; type < total.memory_usage_by_type.size(); type++) {
|
||||
size_t mem = total.memory_usage_by_type[type];
|
||||
if (mem > 0) {
|
||||
AppendMetricValue("type_used_memory", mem, {"type"}, {CompactObj::ObjTypeToString(type)},
|
||||
&type_used_memory_metric);
|
||||
}
|
||||
}
|
||||
absl::StrAppend(&resp->body(), type_used_memory_metric);
|
||||
}
|
||||
|
||||
// Stats metrics
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue