diff --git a/nix/host-modules/swarm-nats.nix b/nix/host-modules/swarm-nats.nix index 671c2d8e..5c97dccc 100644 --- a/nix/host-modules/swarm-nats.nix +++ b/nix/host-modules/swarm-nats.nix @@ -603,6 +603,27 @@ in listenAddress = "127.0.0.1"; port = cfg.metricsPort; url = "http://127.0.0.1:${toString cfg.monitorPort}"; + + # ⚠️ NOT optional, despite the name. Upstream renders + # `-addr … -port … ${extraFlags} ${url}` and defaults + # `extraFlags` to the empty list, but the exporter REFUSES TO + # START without at least one collector: it exits 1 with + # "no Collectors specified". Shipped without this the unit logs + # `Started`, the process is gone milliseconds later, and the + # scrape is refused — measured, and invisible to evaluation + # because the empty list renders perfectly. + # + # Which three, and why not more: `varz` is the server itself + # (uptime, memory, slow consumers), `connz` is per-connection so + # a client that will not stay connected is visible, and `jsz` + # covers JetStream, which this swarm relies on for the status + # KV. The remaining collectors describe a clustered deployment + # this swarm does not have. + extraFlags = [ + "-varz" + "-connz" + "-jsz=all" + ]; }; # A wrapper that includes upstream's rendered settings verbatim