forked from lix-project/hydra
Moar stats
This commit is contained in:
parent
b5815e2aa6
commit
c6fcce3b3b
|
@ -71,7 +71,7 @@ static void openConnection(const string & sshName, const string & sshKey,
|
||||||
|
|
||||||
static void copyClosureTo(std::shared_ptr<StoreAPI> store,
|
static void copyClosureTo(std::shared_ptr<StoreAPI> store,
|
||||||
FdSource & from, FdSink & to, const PathSet & paths,
|
FdSource & from, FdSink & to, const PathSet & paths,
|
||||||
TokenServer & copyClosureTokenServer,
|
TokenServer & copyClosureTokenServer, counter & bytesSent,
|
||||||
bool useSubstitutes = false)
|
bool useSubstitutes = false)
|
||||||
{
|
{
|
||||||
PathSet closure;
|
PathSet closure;
|
||||||
|
@ -115,6 +115,9 @@ static void copyClosureTo(std::shared_ptr<StoreAPI> store,
|
||||||
|
|
||||||
printMsg(lvlDebug, format("sending %1% missing paths") % missing.size());
|
printMsg(lvlDebug, format("sending %1% missing paths") % missing.size());
|
||||||
|
|
||||||
|
for (auto & p : missing)
|
||||||
|
bytesSent += store->queryPathInfo(p).narSize;
|
||||||
|
|
||||||
writeInt(cmdImportPaths, to);
|
writeInt(cmdImportPaths, to);
|
||||||
exportPaths(*store, missing, false, to);
|
exportPaths(*store, missing, false, to);
|
||||||
to.flush();
|
to.flush();
|
||||||
|
@ -125,13 +128,16 @@ static void copyClosureTo(std::shared_ptr<StoreAPI> store,
|
||||||
|
|
||||||
|
|
||||||
static void copyClosureFrom(std::shared_ptr<StoreAPI> store,
|
static void copyClosureFrom(std::shared_ptr<StoreAPI> store,
|
||||||
FdSource & from, FdSink & to, const PathSet & paths)
|
FdSource & from, FdSink & to, const PathSet & paths, counter & bytesReceived)
|
||||||
{
|
{
|
||||||
writeInt(cmdExportPaths, to);
|
writeInt(cmdExportPaths, to);
|
||||||
writeInt(0, to); // == don't sign
|
writeInt(0, to); // == don't sign
|
||||||
writeStrings(paths, to);
|
writeStrings(paths, to);
|
||||||
to.flush();
|
to.flush();
|
||||||
store->importPaths(false, from);
|
store->importPaths(false, from);
|
||||||
|
|
||||||
|
for (auto & p : paths)
|
||||||
|
bytesReceived += store->queryPathInfo(p).narSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,7 +146,8 @@ void buildRemote(std::shared_ptr<StoreAPI> store,
|
||||||
const Path & drvPath, const Derivation & drv,
|
const Path & drvPath, const Derivation & drv,
|
||||||
const nix::Path & logDir, unsigned int maxSilentTime, unsigned int buildTimeout,
|
const nix::Path & logDir, unsigned int maxSilentTime, unsigned int buildTimeout,
|
||||||
TokenServer & copyClosureTokenServer, RemoteResult & result,
|
TokenServer & copyClosureTokenServer, RemoteResult & result,
|
||||||
counter & nrStepsBuilding, counter & nrStepsCopyingTo, counter & nrStepsCopyingFrom)
|
counter & nrStepsBuilding, counter & nrStepsCopyingTo, counter & nrStepsCopyingFrom,
|
||||||
|
counter & bytesSent, counter & bytesReceived)
|
||||||
{
|
{
|
||||||
string base = baseNameOf(drvPath);
|
string base = baseNameOf(drvPath);
|
||||||
result.logFile = logDir + "/" + string(base, 0, 2) + "/" + string(base, 2);
|
result.logFile = logDir + "/" + string(base, 0, 2) + "/" + string(base, 2);
|
||||||
|
@ -188,10 +195,10 @@ void buildRemote(std::shared_ptr<StoreAPI> store,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the input closure. */
|
/* Copy the input closure. */
|
||||||
printMsg(lvlDebug, format("sending closure of ‘%1%’ to ‘%2%’") % drvPath % sshName);
|
if (sshName != "localhost") {
|
||||||
{
|
printMsg(lvlDebug, format("sending closure of ‘%1%’ to ‘%2%’") % drvPath % sshName);
|
||||||
MaintainCount mc(nrStepsCopyingTo);
|
MaintainCount mc(nrStepsCopyingTo);
|
||||||
copyClosureTo(store, from, to, inputs, copyClosureTokenServer);
|
copyClosureTo(store, from, to, inputs, copyClosureTokenServer, bytesSent);
|
||||||
}
|
}
|
||||||
|
|
||||||
autoDelete.cancel();
|
autoDelete.cancel();
|
||||||
|
@ -220,13 +227,13 @@ void buildRemote(std::shared_ptr<StoreAPI> store,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the output paths. */
|
/* Copy the output paths. */
|
||||||
printMsg(lvlDebug, format("copying outputs of ‘%1%’ from ‘%2%’") % drvPath % sshName);
|
if (sshName != "localhost") {
|
||||||
PathSet outputs;
|
printMsg(lvlDebug, format("copying outputs of ‘%1%’ from ‘%2%’") % drvPath % sshName);
|
||||||
for (auto & output : drv.outputs)
|
PathSet outputs;
|
||||||
outputs.insert(output.second.path);
|
for (auto & output : drv.outputs)
|
||||||
{
|
outputs.insert(output.second.path);
|
||||||
MaintainCount mc(nrStepsCopyingFrom);
|
MaintainCount mc(nrStepsCopyingFrom);
|
||||||
copyClosureFrom(store, from, to, outputs);
|
copyClosureFrom(store, from, to, outputs, bytesReceived);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Shut down the connection. */
|
/* Shut down the connection. */
|
||||||
|
|
|
@ -24,4 +24,5 @@ void buildRemote(std::shared_ptr<nix::StoreAPI> store,
|
||||||
const nix::Path & drvPath, const nix::Derivation & drv,
|
const nix::Path & drvPath, const nix::Derivation & drv,
|
||||||
const nix::Path & logDir, unsigned int maxSilentTime, unsigned int buildTimeout,
|
const nix::Path & logDir, unsigned int maxSilentTime, unsigned int buildTimeout,
|
||||||
TokenServer & copyClosureTokenServer, RemoteResult & result,
|
TokenServer & copyClosureTokenServer, RemoteResult & result,
|
||||||
counter & nrStepsBuilding, counter & nrStepsCopyingTo, counter & nrStepsCopyingFrom);
|
counter & nrStepsBuilding, counter & nrStepsCopyingTo, counter & nrStepsCopyingFrom,
|
||||||
|
counter & bytesSent, counter & bytesReceived);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
typedef std::atomic<unsigned int> counter;
|
typedef std::atomic<unsigned long> counter;
|
||||||
|
|
||||||
struct MaintainCount
|
struct MaintainCount
|
||||||
{
|
{
|
||||||
|
|
|
@ -256,6 +256,8 @@ private:
|
||||||
counter totalStepBuildTime{0}; // total build time for steps
|
counter totalStepBuildTime{0}; // total build time for steps
|
||||||
counter nrQueueWakeups{0};
|
counter nrQueueWakeups{0};
|
||||||
counter nrDispatcherWakeups{0};
|
counter nrDispatcherWakeups{0};
|
||||||
|
counter bytesSent{0};
|
||||||
|
counter bytesReceived{0};
|
||||||
|
|
||||||
/* Log compressor work queue. */
|
/* Log compressor work queue. */
|
||||||
Sync<std::queue<Path>> logCompressorQueue;
|
Sync<std::queue<Path>> logCompressorQueue;
|
||||||
|
@ -1158,7 +1160,8 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
|
||||||
/* FIXME: referring builds may have conflicting timeouts. */
|
/* FIXME: referring builds may have conflicting timeouts. */
|
||||||
buildRemote(store, machine->sshName, machine->sshKey, step->drvPath, step->drv,
|
buildRemote(store, machine->sshName, machine->sshKey, step->drvPath, step->drv,
|
||||||
logDir, build->maxSilentTime, build->buildTimeout, copyClosureTokenServer,
|
logDir, build->maxSilentTime, build->buildTimeout, copyClosureTokenServer,
|
||||||
result, nrStepsBuilding, nrStepsCopyingTo, nrStepsCopyingFrom);
|
result, nrStepsBuilding, nrStepsCopyingTo, nrStepsCopyingFrom,
|
||||||
|
bytesSent, bytesReceived);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
result.status = RemoteResult::rrMiscFailure;
|
result.status = RemoteResult::rrMiscFailure;
|
||||||
result.errorMsg = e.msg();
|
result.errorMsg = e.msg();
|
||||||
|
@ -1592,6 +1595,8 @@ void State::dumpStatus(Connection & conn, bool log)
|
||||||
root.attr("nrStepsBuilding", nrStepsBuilding);
|
root.attr("nrStepsBuilding", nrStepsBuilding);
|
||||||
root.attr("nrStepsCopyingTo", nrStepsCopyingTo);
|
root.attr("nrStepsCopyingTo", nrStepsCopyingTo);
|
||||||
root.attr("nrStepsCopyingFrom", nrStepsCopyingFrom);
|
root.attr("nrStepsCopyingFrom", nrStepsCopyingFrom);
|
||||||
|
root.attr("bytesSent", bytesSent);
|
||||||
|
root.attr("bytesReceived", bytesReceived);
|
||||||
root.attr("nrBuildsRead", nrBuildsRead);
|
root.attr("nrBuildsRead", nrBuildsRead);
|
||||||
root.attr("nrBuildsDone", nrBuildsDone);
|
root.attr("nrBuildsDone", nrBuildsDone);
|
||||||
root.attr("nrStepsDone", nrStepsDone);
|
root.attr("nrStepsDone", nrStepsDone);
|
||||||
|
|
|
@ -44,6 +44,9 @@ sub sendQueueRunnerStats {
|
||||||
gauge("hydra.queue.builds.finished", $json->{nrBuildsDone});
|
gauge("hydra.queue.builds.finished", $json->{nrBuildsDone});
|
||||||
|
|
||||||
gauge("hydra.queue.checks", $json->{nrQueueWakeups});
|
gauge("hydra.queue.checks", $json->{nrQueueWakeups});
|
||||||
|
|
||||||
|
gauge("hydra.queue.bytes_sent", $json->{bytesSent});
|
||||||
|
gauge("hydra.queue.bytes_received", $json->{bytesReceived});
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
Loading…
Reference in a new issue