#5215 moved authelia's scrape to `publishedScrapeTargets` and removed
its loopback entry from the authelia module. It was rebased at merge
onto c06aa78b6, which had already moved that loopback entry into
glue-otel-scrape-targets.nix, so the entry survived there. Every host
running authelia and the collector, `singleHostSwarm` included, then
failed swarm-otel.nix's job-name assertion.
The glue now declares only grafana and nats. forge-placement's case
that pinned authelia on loopback now pins its absence, and
swarm-otel-identity gains a case reading the assertion itself on the
single-host fixture, since the option-level case cannot fail a
rebuild the way the assertion does.
Fixes #5247
39 lines
1.7 KiB
Nix
39 lines
1.7 KiB
Nix
# Glue: declare the loopback scrape targets of grafana and nats on the swarm's
|
|
# OTEL collector, wherever one of them shares a host with it. Authelia is a
|
|
# `publishedScrapeTargets` job (./swarm-otel-service.nix); a loopback job of
|
|
# the same name fails ./swarm-otel.nix's job-name assertion.
|
|
#
|
|
# ONE FILE, TWO PAIRINGS — each service ← the collector, with the same shape.
|
|
# Deleting this leaves the collector scraping none of them: no error, no
|
|
# metrics.
|
|
#
|
|
# Each target is gated on the service AND the collector being enabled here. The
|
|
# loopback address is only honest when both run on this host; a target nobody
|
|
# can read asserts a collection that is not happening. Both services default
|
|
# from `deploy.allSwarmServices`, but `mkDefault` is an invitation to override,
|
|
# so co-location is a property of the auto-deployed topology, not the modules.
|
|
#
|
|
# ⚠️ Silent when split: separate hosts are separate evaluations with no shared
|
|
# context, so a host running a service and no collector declares nothing and
|
|
# the collector's host never learns of the service. No error, no warning — a
|
|
# healthy exporter and an empty dashboard. Not guardable from here.
|
|
#
|
|
# ⚠️ `swarm.otel`, not `hyperhive.otel` — two collectors one word apart, and only
|
|
# this one reads `scrapeTargets`.
|
|
{
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
hyperhiveCfg = config.services.hyperhive;
|
|
deployCfg = hyperhiveCfg.deploy;
|
|
swarmCfg = hyperhiveCfg.swarm;
|
|
withCollector = service: lib.mkIf (deployCfg.${service}.enable && deployCfg.swarm-otel.enable);
|
|
in
|
|
{
|
|
config.services.hyperhive.swarm.otel.scrapeTargets = {
|
|
grafana = withCollector "grafana" "127.0.0.1:${toString swarmCfg.grafana.metricsPort}";
|
|
nats = withCollector "nats" "127.0.0.1:${toString swarmCfg.nats.metricsPort}";
|
|
};
|
|
}
|