Builds can now emit metrics that Hydra will store in its database and render as time series via flot charts. Typical applications are to keep track of performance indicators, coverage percentages, artifact sizes, and so on. For example, a coverage build can emit the coverage percentage as follows: echo "lineCoverage $pct %" > $out/nix-support/hydra-metrics Graphs of all metrics for a job can be seen at http://.../job/<project>/<jobset>/<job>#tabs-charts Specific metrics are also visible at http://.../job/<project>/<jobset>/<job>/metric/<metric> The latter URL also allows getting the data in JSON format (e.g. via "curl -H 'Accept: application/json'").
41 lines
825 B
C++
41 lines
825 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include "hash.hh"
|
|
#include "derivations.hh"
|
|
|
|
struct BuildProduct
|
|
{
|
|
nix::Path path, defaultPath;
|
|
std::string type, subtype, name;
|
|
bool isRegular = false;
|
|
nix::Hash sha1hash, sha256hash;
|
|
off_t fileSize = 0;
|
|
BuildProduct() { }
|
|
};
|
|
|
|
struct BuildMetric
|
|
{
|
|
std::string name, unit;
|
|
double value;
|
|
};
|
|
|
|
struct BuildOutput
|
|
{
|
|
/* Whether this build has failed with output, i.e., the build
|
|
finished with exit code 0 but produced a file
|
|
$out/nix-support/failed. */
|
|
bool failed = false;
|
|
|
|
std::string releaseName;
|
|
|
|
unsigned long long closureSize = 0, size = 0;
|
|
|
|
std::list<BuildProduct> products;
|
|
|
|
std::map<std::string, BuildMetric> metrics;
|
|
};
|
|
|
|
BuildOutput getBuildOutput(std::shared_ptr<nix::StoreAPI> store, const nix::Derivation & drv);
|