Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate metrics to reduce cardinality #5166

Merged
merged 10 commits into from
Jul 4, 2022
8 changes: 7 additions & 1 deletion tools/rpcgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// This file is autogenerated. Manual changes will be lost.
#pragma once

#include "config/configuration.h"
#include "reflection/adl.h"
#include "rpc/types.h"
#include "rpc/parse_utils.h"
Expand Down Expand Up @@ -86,13 +87,18 @@ class failure_probes;
std::vector<ss::metrics::label_instance> labels{
service_label("{{service_name}}"),
method_label("{{method.name}}")};
auto aggregate_labels
= config::shard_local_cfg().aggregate_metrics()
? std::vector<sm::label>{sm::shard_label, method_label}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's neat

: std::vector<sm::label>{};
_metrics.add_group(
prometheus_sanitize::metrics_name("internal_rpc"),
{sm::make_histogram(
"latency",
[this] { return _methods[{{loop.index-1}}].probes.latency_hist().seastar_histogram_logform(); },
sm::description("Internal RPC service latency"),
labels)});
labels)
.aggregate(aggregate_labels)});
}
{%- endfor %}
}
Expand Down