aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/metrics/attribute_metrics.h
blob: 688c47e148f5c76e90a203ebc30d98a8cfa5f675 (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
29
30
31
32
33
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "memory_usage_metrics.h"
#include <map>

namespace proton {

class AttributeMetrics
{
public:
    struct Entry : public metrics::MetricSet {
        using SP = std::shared_ptr<Entry>;
        MemoryUsageMetrics memoryUsage;
        Entry(const vespalib::string &attrName);
    };
private:
    using Map = std::map<vespalib::string, Entry::SP>;

    metrics::MetricSet *_parent;
    Map _attributes;

public:
    AttributeMetrics(metrics::MetricSet *parent);
    Entry::SP add(const vespalib::string &attrName);
    Entry::SP get(const vespalib::string &attrName) const;
    Entry::SP remove(const vespalib::string &attrName);
    std::vector<Entry::SP> release();
    metrics::MetricSet *parent() { return _parent; }
};

} // namespace proton