aboutsummaryrefslogtreecommitdiffstats
path: root/metrics/src/vespa/metrics/name_repo.h
blob: b7769303f0b9d31d4de9c248b11d47e9adcb3d95 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/metrics/handle.h>

namespace metrics {

struct MetricNameIdTag {};
struct DescriptionIdTag {};
struct TagKeyIdTag {};
struct TagValueIdTag {};

using MetricNameId = vespalib::metrics::Handle<MetricNameIdTag>;
using DescriptionId = vespalib::metrics::Handle<DescriptionIdTag>;
using TagKeyId = vespalib::metrics::Handle<TagKeyIdTag>;
using TagValueId = vespalib::metrics::Handle<TagValueIdTag>;

struct NameRepo {
    static MetricNameId metricId(const vespalib::string &name);
    static DescriptionId descriptionId(const vespalib::string &name);
    static TagKeyId tagKeyId(const vespalib::string &name);
    static TagValueId tagValueId(const vespalib::string &value);

    static const vespalib::string& metricName(MetricNameId id);
    static const vespalib::string& description(DescriptionId id);
    static const vespalib::string& tagKey(TagKeyId id);
    static const vespalib::string& tagValue(TagValueId id);
};

} // metrics