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);
void remove(const std::string &name, const std::vector<std::pair<std::string, std::string>> &labels);
+ void remove_if_exists(const std::string &name, const std::vector<std::pair<std::string, std::string>> &labels);
+
std::string serialize() const;
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;