deploy: move the metrics and log store toggles
Same move as grafana, and the three belong together: they derive from one switch and a store with no UI is as useless as a UI with no store. `victorialogs` is the case that shows why the option-path sweep is not enough on its own. It has **zero** references spelled `swarm.victorialogs.enable` anywhere in the tree, and four spelled through `let` aliases (`vlCfg.enable` in the collector, `cfg.enable` in its own module). A sweep for the path would have reported nothing to do and left every reader broken. Prose moved with the code rather than being left behind: the comments in swarm-required-services.nix that explained why the pair derives together now sit above the assignments that do it, instead of above the gap where they used to be.
This commit is contained in:
parent
cf1f2f99cf
commit
29647f963e
9 changed files with 77 additions and 61 deletions
|
|
@ -29,6 +29,7 @@
|
|||
}:
|
||||
let
|
||||
cfg = config.services.hyperhive.swarm.victorialogs;
|
||||
deployCfg = config.services.hyperhive.deploy;
|
||||
networkCfg = config.services.hyperhive.network;
|
||||
hyperhiveCfg = config.services.hyperhive;
|
||||
gatewayCfg = hyperhiveCfg.gateway;
|
||||
|
|
@ -52,18 +53,10 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
# `enable` moved to `services.hyperhive.deploy.victorialogs` — see
|
||||
# ./deploy.nix. What stays here is what the store IS: its package,
|
||||
# domain, retention and wiring.
|
||||
options.services.hyperhive.swarm.victorialogs = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Run the swarm's log store on this host. Off by default and not
|
||||
derived from {option}`services.hyperhive.enable`: a swarm has one
|
||||
log store, so enabling it is a decision about swarm topology
|
||||
rather than about whether hyperhive is installed.
|
||||
'';
|
||||
};
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.victorialogs;
|
||||
|
|
@ -128,7 +121,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (hyperhiveCfg.enable && cfg.enable) {
|
||||
config = lib.mkIf (hyperhiveCfg.enable && deployCfg.victorialogs) {
|
||||
# This store publishes its own health as prometheus metrics on the same
|
||||
# listener it serves queries on, so the swarm's collector scrapes it with
|
||||
# no exporter and no extra port — same arrangement as the metrics store.
|
||||
|
|
@ -141,7 +134,7 @@ in
|
|||
# hosts are separate evaluations.
|
||||
services.hyperhive.swarm.otel.scrapeTargets.victorialogs = "127.0.0.1:${toString cfg.port}";
|
||||
|
||||
# The gateway name and the quick-link, both inside `cfg.enable` — same
|
||||
# The gateway name and the quick-link, both inside `deployCfg.victorialogs` — same
|
||||
# "only the host that runs the service may claim the name" guard every
|
||||
# sibling swarm-service module uses (`swarm-grafana.nix`,
|
||||
# `swarm-victoriametrics.nix`).
|
||||
|
|
|
|||
Loading…
Reference in a new issue