Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
Label.hpp
1#pragma once
2
3#include <string>
4#include <vector>
5
6namespace util::prometheus {
7
11class Label {
12public:
19 Label(std::string name, std::string value);
20
21 auto
22 operator<=>(Label const& rhs) const = default;
23
30 std::string
31 serialize() const;
32
33private:
34 std::string name_;
35 std::string value_;
36};
37
41class Labels {
42public:
43 Labels() = default;
44
50 explicit Labels(std::vector<Label> labels);
51
58 std::string
59 serialize() const;
60
61private:
62 std::vector<Label> labels_;
63};
64
65} // namespace util::prometheus
Label(std::string name, std::string value)
Construct a new Label object.
Definition Label.cpp:12
std::string serialize() const
Serialize the label to a string in Prometheus format (e.g. name="value"). The value is escaped.
Definition Label.cpp:17
Label(std::string name, std::string value)
Construct a new Label object.
Definition Label.cpp:12
std::string serialize() const
Serialize the labels to a string in Prometheus format (e.g. {"name1="value1",name2="value2"}...
Definition Label.cpp:48