4 // A simple global class to keep track of metrics export in Prometheus format.
5 // It would be better to use a more full-featured Prometheus client library for this,
6 // but it would introduce a dependency that is not commonly packaged in distributions,
7 // which makes it quite unwieldy. Thus, we'll package our own for the time being.
12 #include <unordered_map>
21 void add(const std::string &name, std::atomic<int64_t> *location, Type type = TYPE_COUNTER);
22 void add(const std::string &name, std::atomic<double> *location, Type type = TYPE_COUNTER);
23 std::string serialize() const;
29 std::atomic<T> *location;
32 mutable std::mutex mu;
33 std::unordered_map<std::string, Metric<int64_t>> int_metrics;
34 std::unordered_map<std::string, Metric<double>> double_metrics;
37 extern Metrics global_metrics;
39 #endif // !defined(_METRICS_H)