Watch
0
0
Fork
You've already forked hyperhive
0

export the swarm cache's size from atticd's database to the attic dashboard

This commit is contained in:
atlas 2026-11-01 23:44:54 +01:00
commit c0429bf617

View file

@ -497,6 +497,33 @@ let
&& !(atticExternal.containers ? swarm-attic)
&& atticExternal.services.hyperhive.swarm.otel.serviceProducers ? swarm-attic;
}
{
# The exporter reads atticd's database through a read-only URI, as a
# dynamic user and not root, and pushes to the forwarder's OTLP receiver,
# whose port the forwarder opens. The host with the cache off is the
# control that nothing of it renders there.
name = "the cache's container exports its size from a read-only look at the database, as a non-root user, through the forwarder";
ok =
let
inner = atticHere.containers.swarm-attic.config;
svc = inner.systemd.services.swarm-attic-cache-size;
f = inner.services.hyperhive.swarmJournalForwarder;
port = toString f.otlpMetricsPort;
in
svc.serviceConfig.Type == "oneshot"
&& svc.serviceConfig.DynamicUser
&& svc.serviceConfig.User == "swarm-attic"
&& lib.hasInfix "-readonly" svc.script
&& lib.hasInfix "server.db?mode=ro" svc.script
&& !(lib.hasInfix "mode=rw" svc.script)
&& lib.hasInfix "state = 'V'" svc.script
&& lib.hasInfix "hyperhive.attic.cache_bytes" svc.script
&& lib.hasInfix "hyperhive.attic.cache_nars" svc.script
&& lib.hasInfix "127.0.0.1:${port}/v1/metrics" svc.script
&& f.otlpMetricsPort != null
&& inner.systemd.timers ? swarm-attic-cache-size
&& !(atticExternal.containers ? swarm-attic);
}
{
# attic checks its own tokens and a nix client cannot follow a login
# redirect, so the vhost carries no `auth_request`; the tokens ride in a