[COMMIT seastar master] prometheus.cc: change function in foreach_metrics to use const ref

0 views
Skip to first unread message

Commit Bot

<bot@cloudius-systems.com>
unread,
May 22, 2023, 10:00:06 AM5/22/23
to seastar-dev@googlegroups.com, Amnon Heiman
From: Amnon Heiman <am...@scylladb.com>
Committer: Avi Kivity <a...@scylladb.com>
Branch: master

prometheus.cc: change function in foreach_metrics to use const ref

metric_family.foreach_metric passes parameters to the handled function
by const ref. The implmentation code used auto, which added an unneeded
copy.

This patch changes it to const reference.

Ref scylladb/scylladb#13929

Signed-off-by: Amnon Heiman <am...@scylladb.com>

Closes #1665

---
diff --git a/src/core/prometheus.cc b/src/core/prometheus.cc
--- a/src/core/prometheus.cc
+++ b/src/core/prometheus.cc
@@ -588,7 +588,7 @@ future<> write_text_representation(output_stream<char>& out, const config& ctx,
found = false;
metric_aggregate_by_labels aggregated_values(metric_family.metadata().aggregate_labels);
bool should_aggregate = !metric_family.metadata().aggregate_labels.empty();
- metric_family.foreach_metric([&s, &out, &ctx, &found, &name, &metric_family, &aggregated_values, should_aggregate, show_help, &filter](auto value, auto value_info) mutable {
+ metric_family.foreach_metric([&s, &out, &ctx, &found, &name, &metric_family, &aggregated_values, should_aggregate, show_help, &filter](const mi::metric_value& value, const mi::metric_info& value_info) mutable {
s.clear();
s.str("");
if ((value_info.should_skip_when_empty && value.is_empty()) || !filter(value_info.id.labels())) {
Reply all
Reply to author
Forward
0 new messages