First Commit
/ build_macos (push) Has been cancelled
/ build_windows (push) Has been cancelled
/ build_ubuntu (push) Has been cancelled

This commit is contained in:
dsutanto committed 2025-11-19 16:23:45 +07:00
commit dbdc5bcc4a
1791 files changed
+489451

No files matched your search

@@ -0,0 +1,35 @@
#pragma once
#include <string>
#include <map>
#include "registry.h"
namespace prometheus {
template <typename CustomMetric>
class Builder {
Family::Labels labels_;
std::string name_;
std::string help_;
public:
Builder& Labels(const std::map<const std::string, const std::string>& labels) {
labels_ = labels;
return *this;
}
Builder& Name(const std::string& name) {
name_ = name;
return *this;
}
Builder& Help(const std::string& help) {
help_ = help;
return *this;
}
CustomFamily<CustomMetric>& Register(Registry& registry) {
return registry.Add<CustomFamily<CustomMetric>>(name_, help_, labels_);
}
};
}