WIP: I love it when they delete the assignment operator :)
This commit is contained in:
parent
15e8fa8aff
commit
5bff730f2c
|
@ -49,7 +49,20 @@ 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(call_ctr_family.Add({}))
|
||||||
{
|
{
|
||||||
|
// 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");
|
||||||
|
@ -58,6 +71,7 @@ State::State(std::optional<std::string> metricsAddrOpt)
|
||||||
metricsAddr = metricsAddrOpt.value();
|
metricsAddr = metricsAddrOpt.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* handle deprecated store specification */
|
/* handle deprecated store specification */
|
||||||
if (config->getStrOption("store_mode") != "")
|
if (config->getStrOption("store_mode") != "")
|
||||||
throw Error("store_mode in hydra.conf is deprecated, please use store_uri");
|
throw Error("store_mode in hydra.conf is deprecated, please use store_uri");
|
||||||
|
@ -767,6 +781,7 @@ void State::run(BuildID buildOne)
|
||||||
/* Set up simple exporter, to show that we're still alive. */
|
/* Set up simple exporter, to show that we're still alive. */
|
||||||
prometheus::Exposer promExposer{metricsAddr};
|
prometheus::Exposer promExposer{metricsAddr};
|
||||||
auto exposerPort = promExposer.GetListeningPorts().front();
|
auto exposerPort = promExposer.GetListeningPorts().front();
|
||||||
|
|
||||||
promExposer.RegisterCollectable(registry);
|
promExposer.RegisterCollectable(registry);
|
||||||
|
|
||||||
std::cout << "Started the Prometheus exporter, listening on "
|
std::cout << "Started the Prometheus exporter, listening on "
|
||||||
|
|
|
@ -82,6 +82,8 @@ 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();
|
||||||
|
|
||||||
printInfo("checking the queue for builds > %d...", lastBuildId);
|
printInfo("checking the queue for builds > %d...", lastBuildId);
|
||||||
|
|
||||||
/* Grab the queued builds from the database, but don't process
|
/* Grab the queued builds from the database, but don't process
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
|
#include <prometheus/counter.h>
|
||||||
#include <prometheus/registry.h>
|
#include <prometheus/registry.h>
|
||||||
|
|
||||||
#include "db.hh"
|
#include "db.hh"
|
||||||
|
@ -434,10 +435,13 @@ private:
|
||||||
via gc_roots_dir. */
|
via gc_roots_dir. */
|
||||||
nix::Path rootsDir;
|
nix::Path rootsDir;
|
||||||
|
|
||||||
std::string metricsAddr;;
|
std::string metricsAddr;
|
||||||
|
|
||||||
std::shared_ptr<prometheus::Registry> registry;
|
std::shared_ptr<prometheus::Registry> registry;
|
||||||
|
|
||||||
|
// prometheus::Family<prometheus::Counter>& call_ctr_family;
|
||||||
|
prometheus::Counter& call_ctr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
State(std::optional<std::string> metricsAddrOpt);
|
State(std::optional<std::string> metricsAddrOpt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue