-
Notifications
You must be signed in to change notification settings - Fork 0
/
prometheus_metric.h
36 lines (28 loc) · 782 Bytes
/
prometheus_metric.h
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
#ifndef PROMETHEUS_METRIC_H
#define PROMETHEUS_METRIC_H
#include "Arduino.h"
#include <unordered_map>
enum MetricType : short {
untyped = 0, counter, gauge, histogram, summary
};
class Metric {
private:
String name;
String helpText;
std::unordered_map<std::string, std::string> labels;
MetricType type;
float value;
int precision;
public:
String getString();
Metric(MetricType type, String name, String helpText, int precision);
Metric(MetricType type, String name, String helpText, int precision, std::unordered_map<std::string, std::string> labels);
void setValue(float val) {
this->value = val;
}
void setValue(float val, std::unordered_map<std::string, std::string> labels) {
this->value = val;
this->labels = labels;
}
};
#endif