diff options
author | Geir Storli <geirst@verizonmedia.com> | 2021-06-15 10:43:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-15 10:43:37 +0200 |
commit | 8628cb25532508e615a8bfe580799f20d0c5afe7 (patch) | |
tree | 39c15e5a7e4e74a080d451c80b6f56660f81c809 /storage | |
parent | e5186c39d967350cdc9e1fe61a4622d7b1dbc965 (diff) | |
parent | ffd882eb021758a293b2ded2451d4981de8801f6 (diff) |
Merge pull request #18247 from vespa-engine/toregge/aggregate-metrics-on-the-fly-when-adding-to-snapshot
Aggregate distributor metrics when adding to snapshot.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/distributor/distributor_total_metrics.cpp | 22 | ||||
-rw-r--r-- | storage/src/vespa/storage/distributor/distributor_total_metrics.h | 2 |
2 files changed, 20 insertions, 4 deletions
diff --git a/storage/src/vespa/storage/distributor/distributor_total_metrics.cpp b/storage/src/vespa/storage/distributor/distributor_total_metrics.cpp index 543712cc4d2..510b1df2ff3 100644 --- a/storage/src/vespa/storage/distributor/distributor_total_metrics.cpp +++ b/storage/src/vespa/storage/distributor/distributor_total_metrics.cpp @@ -18,16 +18,30 @@ 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; + aggregate_helper(total); + total.addToSnapshot(m, ownerList); +} + +void DistributorTotalMetrics::reset() { DistributorMetricSet::reset(); diff --git a/storage/src/vespa/storage/distributor/distributor_total_metrics.h b/storage/src/vespa/storage/distributor/distributor_total_metrics.h index 14116af3d3b..f0457fe64c3 100644 --- a/storage/src/vespa/storage/distributor/distributor_total_metrics.h +++ b/storage/src/vespa/storage/distributor/distributor_total_metrics.h @@ -15,10 +15,12 @@ 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; void aggregate(); + void addToSnapshot(Metric& m, std::vector<Metric::UP> &ownerList) const override; void reset() override; DistributorMetricSet& stripe(uint32_t stripe_index) { return *_stripes_metrics[stripe_index]; } DistributorMetricSet& bucket_db_updater_metrics() { return _bucket_db_updater_metrics; } |