blob: c796aeceb4c2900965247493a94f96641cc92226 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "name_repo.h"
#include <vespa/vespalib/metrics/name_collection.h>
using vespalib::metrics::NameCollection;
namespace metrics {
namespace {
NameCollection metricNames;
NameCollection descriptions;
NameCollection tagKeys;
NameCollection tagValues;
}
MetricNameId
NameRepo::metricId(const vespalib::string &name)
{
size_t id = metricNames.resolve(name);
return MetricNameId(id);
}
DescriptionId
NameRepo::descriptionId(const vespalib::string &name)
{
size_t id = descriptions.resolve(name);
return DescriptionId(id);
}
TagKeyId
NameRepo::tagKeyId(const vespalib::string &name)
{
size_t id = tagKeys.resolve(name);
return TagKeyId(id);
}
TagValueId
NameRepo::tagValueId(const vespalib::string &value)
{
size_t id = tagValues.resolve(value);
return TagValueId(id);
}
const vespalib::string&
NameRepo::metricName(MetricNameId id)
{
return metricNames.lookup(id.id());
}
const vespalib::string&
NameRepo::description(DescriptionId id)
{
return descriptions.lookup(id.id());
}
const vespalib::string&
NameRepo::tagKey(TagKeyId id)
{
return tagKeys.lookup(id.id());
}
const vespalib::string&
NameRepo::tagValue(TagValueId id)
{
return tagValues.lookup(id.id());
}
} // namespace metrics
|