X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=shared%2Fmetrics.h;h=1f130c981ba65684d77b44c627832a3b93d1be40;hp=e2e1e74f5ac9bb818f5bbdb8e6798ec27cadf869;hb=ed041ec8c0fa1dd31fd3c3ac053da13519c524c3;hpb=e0d676aec4f44252170da8e1c8824421ac6976ff diff --git a/shared/metrics.h b/shared/metrics.h index e2e1e74..1f130c9 100644 --- a/shared/metrics.h +++ b/shared/metrics.h @@ -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 *location, Type type = TYPE_COUNTER) { add(name, {}, location, type); @@ -113,6 +118,7 @@ private: mutable std::mutex mu; std::map types; // Ordered the same as metrics. std::map metrics; + static std::string prefix; friend class Histogram; friend class Summary;