Watch
0
0
Fork
You've already forked hyperhive
0

builds board: a Grafana dashboard of the container builds, from the lines hive-c0re logs

A builds tab (counts, failures, longest, builds over time by outcome, a table of
each build) and an output tab (every line of the build picked in the Build
filter). The table joins its grouped stats by labels, one row per build.
This commit is contained in:
iris 2026-11-01 16:16:23 +01:00 • committed by mara
commit ab30c3dc7d

View file

@ -478,6 +478,52 @@ let
]
&& (lib.head xf).spec.options.byField == "agent";
}
{
# The builds board reads the fields hive-c0re puts on every container-build
# log line: the build id, agent and kind on each, the event on the start and
# finish lines, and the status and runtime on the finish line. A renamed
# field in hive-c0re is a board of empty panels, so each field the board
# filters or groups by must still be set there.
name = "the builds dashboard ships, and reads the fields hive-c0re logs on a container build";
ok =
let
provider = lib.head grafanaWithAuthelia.containers.swarm-grafana.config.services.grafana.provision.dashboards.settings.providers;
shipped = lib.attrNames provider.options.path.entries;
board = builtins.fromJSON (builtins.readFile ../host-modules/swarm-grafana/dashboards/builds.json);
exprs = map (e: (lib.head e.spec.data.spec.queries).spec.query.spec.expr) (
lib.attrValues board.spec.elements
);
tabs = map (t: t.spec.title) board.spec.layout.spec.tabs;
logged = builtins.readFile ../../hive-c0re/src/lifecycle/mod.rs;
tables = lib.filter (e: e.spec.vizConfig.group == "table") (lib.attrValues board.spec.elements);
in
lib.elem "builds.json" shipped
&&
tabs == [
"builds"
"output"
]
&& lib.all (e: lib.hasInfix "TARGET:\"nixos-container\"" e) exprs
&& lib.hasInfix "event = \"finish\"" logged
&& lib.hasInfix "event = \"start\"" logged
# each field as the logging macro spells it (`status` is a bare local)
&& lib.all (f: lib.hasInfix f logged) [
"build_id = "
"agent = "
"kind = "
"status,"
"runtime_secs = "
]
&& lib.hasInfix "target: \"nixos-container\"" logged
# a grouped stats table is one frame per group: joined by labels, one row per group
&& lib.all (
e:
map (t: t.spec.id) e.spec.data.spec.transformations == [
"joinByLabels"
"organize"
]
) tables;
}
{
# The egress board ships, and its queries read the two squid log lines as
# squid writes them: the would_deny line's field layout, and the default