From 83ab25ceea327ba8a98d534d805ce52a73b88491 Mon Sep 17 00:00:00 2001 From: Ben Pope Date: Mon, 6 Jun 2022 22:29:38 +0100 Subject: [PATCH] metrics: pandaproxy: default aggregations Aggregate over shard, method by default This accounts for pandaproxy and schema registry, so an addional service label will be added (later). Signed-off-by: Ben Pope --- src/v/pandaproxy/probe.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/v/pandaproxy/probe.cc b/src/v/pandaproxy/probe.cc index 981f335df7249..b1122de65a895 100644 --- a/src/v/pandaproxy/probe.cc +++ b/src/v/pandaproxy/probe.cc @@ -23,15 +23,26 @@ probe::probe(ss::httpd::path_description& path_desc) return; } namespace sm = ss::metrics; + + auto operation_label = sm::label("operation"); std::vector labels{ - sm::label("operation")(path_desc.operations.nickname)}; + operation_label(path_desc.operations.nickname)}; + + auto aggregate_labels = std::vector{ + sm::shard_label, operation_label}; + auto internal_aggregate_labels + = config::shard_local_cfg().aggregate_metrics() + ? aggregate_labels + : std::vector{}; + _metrics.add_group( "pandaproxy", {sm::make_histogram( "request_latency", sm::description("Request latency"), - std::move(labels), - [this] { return _request_hist.seastar_histogram_logform(); })}); + labels, + [this] { return _request_hist.seastar_histogram_logform(); }, + internal_aggregate_labels)}); } -} // namespace pandaproxy \ No newline at end of file +} // namespace pandaproxy