aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/metrics/metric_types.h
blob: 68bc9caaa0a351c71311799981cf76460e73463e (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 <mutex>
#include <vector>
#include <vespa/vespalib/stllike/string.h>

namespace vespalib {
namespace metrics {

// internal class for typechecking
class MetricTypes {
    static const char *_typeNames[];
public:
    enum MetricType {
        INVALID,
        COUNTER,
        GAUGE,
        HISTOGRAM,
        INT_HISTOGRAM
    };

    void check(size_t id, const vespalib::string& name, MetricType ty);

    MetricTypes() = default;
    ~MetricTypes() {}
private:
    std::mutex _lock;
    std::vector<MetricType> _seen;
};

} // namespace vespalib::metrics
} // namespace vespalib