blob: ad3e23bbbf17411cf72882b243f816a567229a5a (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <memory>
#include <vespa/vespalib/stllike/string.h>
#include "point.h"
#include "point_map.h"
namespace vespalib {
namespace metrics {
class MetricsManager;
/**
* Build a Point for labeling metrics
**/
class PointBuilder {
private:
std::shared_ptr<MetricsManager> _owner;
PointMap _map;
public:
// for use from MetricsManager
PointBuilder(std::shared_ptr<MetricsManager> m);
PointBuilder(std::shared_ptr<MetricsManager> m, const PointMap &from);
~PointBuilder() {}
/**
* Bind a dimension to a label.
* Overwrites any label already bound to that dimension.
**/
PointBuilder &&bind(Dimension dimension, Label label) &&;
PointBuilder &bind(Dimension dimension, Label label) &;
/**
* Bind a dimension to a label.
* Convenience method that converts the label value.
**/
PointBuilder &&bind(Dimension dimension, LabelValue label) &&;
PointBuilder &bind(Dimension dimension, LabelValue label) &;
/**
* Bind a dimension to a label.
* Convenience method that converts both the dimension name and the label value.
**/
PointBuilder &&bind(DimensionName dimension, LabelValue label) &&;
PointBuilder &bind(DimensionName dimension, LabelValue label) &;
/** make a Point from the builder */
Point build();
/** make a Point from the builder */
operator Point () &&;
};
} // namespace vespalib::metrics
} // namespace vespalib
|