]> git.sesse.net Git - nageru/blobdiff - shared/metrics.h
Prefix all the Futatabi Prometheus metrics by futatabi_ instead of nageru_.
[nageru] / shared / metrics.h
index e2e1e74f5ac9bb818f5bbdb8e6798ec27cadf869..1f130c981ba65684d77b44c627832a3b93d1be40 100644 (file)
@@ -38,6 +38,11 @@ public:
                PRINT_WHEN_NONEMPTY,
        };
 
+       void set_prefix(const std::string &prefix)  // Not thread-safe; must be set before HTTPD starts up.
+       {
+               this->prefix = prefix;
+       }
+
        void add(const std::string &name, std::atomic<int64_t> *location, Type type = TYPE_COUNTER)
        {
                add(name, {}, location, type);
@@ -113,6 +118,7 @@ private:
        mutable std::mutex mu;
        std::map<std::string, Type> types;  // Ordered the same as metrics.
        std::map<MetricKey, Metric> metrics;
+       static std::string prefix;
 
        friend class Histogram;
        friend class Summary;