summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-06-14 14:46:05 +0200
committerTor Egge <Tor.Egge@online.no>2021-06-14 14:46:05 +0200
commitffd882eb021758a293b2ded2451d4981de8801f6 (patch)
tree6c146f230f37af6859b956da1f3d6d954887d5b6 /storage
parent86be1befadd23afb27b76d2f4f7b4d4d0fb2b1fe (diff)
Factor out common code to private helper member function.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/distributor/distributor_total_metrics.cpp19
-rw-r--r--storage/src/vespa/storage/distributor/distributor_total_metrics.h1
2 files changed, 12 insertions, 8 deletions
diff --git a/storage/src/vespa/storage/distributor/distributor_total_metrics.cpp b/storage/src/vespa/storage/distributor/distributor_total_metrics.cpp
index fff996958b3..510b1df2ff3 100644
--- a/storage/src/vespa/storage/distributor/distributor_total_metrics.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_total_metrics.cpp
@@ -18,23 +18,26 @@ DistributorTotalMetrics::DistributorTotalMetrics(uint32_t num_distributor_stripe
DistributorTotalMetrics::~DistributorTotalMetrics() = default;
void
-DistributorTotalMetrics::aggregate()
+DistributorTotalMetrics::aggregate_helper(DistributorMetricSet &total) const
{
- DistributorMetricSet::reset();
- _bucket_db_updater_metrics.addToPart(*this);
+ _bucket_db_updater_metrics.addToPart(total);
for (auto &stripe_metrics : _stripes_metrics) {
- stripe_metrics->addToPart(*this);
+ stripe_metrics->addToPart(total);
}
}
void
+DistributorTotalMetrics::aggregate()
+{
+ DistributorMetricSet::reset();
+ aggregate_helper(*this);
+}
+
+void
DistributorTotalMetrics::addToSnapshot(Metric& m, std::vector<Metric::UP> &ownerList) const
{
DistributorMetricSet total;
- _bucket_db_updater_metrics.addToPart(total);
- for (auto &stripe_metrics : _stripes_metrics) {
- stripe_metrics->addToPart(total);
- }
+ aggregate_helper(total);
total.addToSnapshot(m, ownerList);
}
diff --git a/storage/src/vespa/storage/distributor/distributor_total_metrics.h b/storage/src/vespa/storage/distributor/distributor_total_metrics.h
index 7b4f705a6fe..f0457fe64c3 100644
--- a/storage/src/vespa/storage/distributor/distributor_total_metrics.h
+++ b/storage/src/vespa/storage/distributor/distributor_total_metrics.h
@@ -15,6 +15,7 @@ class DistributorTotalMetrics : public DistributorMetricSet
{
std::vector<std::shared_ptr<DistributorMetricSet>> _stripes_metrics;
DistributorMetricSet _bucket_db_updater_metrics;
+ void aggregate_helper(DistributorMetricSet &total) const;
public:
explicit DistributorTotalMetrics(uint32_t num_distributor_stripes);
~DistributorTotalMetrics() override;