bring back the working version Cole made

This commit is contained in:
Graham Christensen 2022-04-06 15:49:38 -04:00
parent 5bff730f2c
commit 46f52b4c4e
3 changed files with 8 additions and 16 deletions

View file

@ -49,20 +49,12 @@ State::State(std::optional<std::string> metricsAddrOpt)
, rootsDir(config->getStrOption("gc_roots_dir", fmt("%s/gcroots/per-user/%s/hydra-roots", settings.nixStateDir, getEnvOrDie("LOGNAME")))) , rootsDir(config->getStrOption("gc_roots_dir", fmt("%s/gcroots/per-user/%s/hydra-roots", settings.nixStateDir, getEnvOrDie("LOGNAME"))))
, metricsAddr(config->getStrOption("queue_runner_metrics_address", std::string{"127.0.0.1:9198"})) , metricsAddr(config->getStrOption("queue_runner_metrics_address", std::string{"127.0.0.1:9198"}))
, registry(std::make_shared<prometheus::Registry>()) , registry(std::make_shared<prometheus::Registry>())
// , call_ctr_family(prometheus::BuildCounter().Name("queue_queued_builds_calls_total").Help("Number of times State::getQueuedBuilds() was called").Register(*registry)) , call_ctr(prometheus::BuildCounter()
// , call_ctr(call_ctr_family.Add({})) .Name("queue_queued_builds_calls_total")
.Help("Number of times State::getQueuedBuilds() was called")
.Register(*registry))
, queue_queued_builds_calls(call_ctr.Add({})) // FIXME: add the proper arguments
{ {
// call_ctr_family(prometheus::BuildCounter().Name("queue_queued_builds_calls_total").Help("Number of times State::getQueuedBuilds() was called").Register(*registry));
// call_ctr(call_ctr_family.Add({}));
auto& fam = prometheus::BuildCounter()
.Name("queue_queued_builds_calls_total")
.Help("Number of times State::getQueuedBuilds() was called")
.Register(*registry)
.Add({});
// call_ctr_family(fam);
// call_ctr(call_ctr_family.Add({}));
hydraData = getEnvOrDie("HYDRA_DATA"); hydraData = getEnvOrDie("HYDRA_DATA");
logDir = canonPath(hydraData + "/build-logs"); logDir = canonPath(hydraData + "/build-logs");

View file

@ -82,7 +82,7 @@ struct PreviousFailure : public std::exception {
bool State::getQueuedBuilds(Connection & conn, bool State::getQueuedBuilds(Connection & conn,
ref<Store> destStore, unsigned int & lastBuildId) ref<Store> destStore, unsigned int & lastBuildId)
{ {
call_ctr.Increment(); queue_queued_builds_calls.Increment();
printInfo("checking the queue for builds > %d...", lastBuildId); printInfo("checking the queue for builds > %d...", lastBuildId);

View file

@ -439,8 +439,8 @@ private:
std::shared_ptr<prometheus::Registry> registry; std::shared_ptr<prometheus::Registry> registry;
// prometheus::Family<prometheus::Counter>& call_ctr_family; prometheus::Family<prometheus::Counter>& call_ctr;
prometheus::Counter& call_ctr; prometheus::Counter& queue_queued_builds_calls;
public: public:
State(std::optional<std::string> metricsAddrOpt); State(std::optional<std::string> metricsAddrOpt);