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>
16 void register_int_metric(const std::string &name, std::atomic<int64_t> *location);
17 void register_double_metric(const std::string &name, std::atomic<double> *location);
18 std::string serialize() const;
21 mutable std::mutex mu;
22 std::unordered_map<std::string, std::atomic<int64_t> *> int_metrics;
23 std::unordered_map<std::string, std::atomic<double> *> double_metrics;
26 extern Metrics global_metrics;
28 #endif // !defined(_METRICS_H)