aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/distributor/ideal_state_total_metrics.h
blob: 5c3d8bb0a937c68640b8f63a1593c795e1bc9a7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "idealstatemetricsset.h"

namespace storage::distributor {

/*
 * Class presenting total metrics (as an IdealStateMetricSet) to the metric framework,
 * while managing an IdealStateMetricSet for each distributor stripe.
 */
class IdealStateTotalMetrics : public IdealStateMetricSet {
private:
    std::vector<std::shared_ptr<IdealStateMetricSet>> _stripes_metrics;

    void aggregate_helper(IdealStateMetricSet& total) const;

public:
    explicit IdealStateTotalMetrics(uint32_t num_distributor_stripes);
    ~IdealStateTotalMetrics() override;
    void aggregate();
    void addToSnapshot(Metric& m, std::vector<Metric::UP>& owner_list) const override;
    void reset() override;
    IdealStateMetricSet& stripe(uint32_t stripe_index) { return *_stripes_metrics[stripe_index]; }
};

}