monitoring: always include tier label in scrape configs
All checks were successful
Run nix flake check / flake-check (push) Successful in 2m8s

Previously tier was only included if non-default (not "prod"), which
meant prod hosts had no tier label. This made the Grafana tier filter
only show "test" since "prod" never appeared in label_values().

Now tier is always included, so both "prod" and "test" appear in the
fleet dashboard tier selector.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 20:58:52 +01:00
parent d333aa0164
commit 1e52eec02a

View File

@@ -58,10 +58,9 @@ let
}; };
# Build effective labels for a host # Build effective labels for a host
# Always includes hostname; only includes tier/priority/role if non-default # Always includes hostname and tier; only includes priority/role if non-default
buildEffectiveLabels = host: buildEffectiveLabels = host:
{ hostname = host.hostname; } { hostname = host.hostname; tier = host.tier; }
// (lib.optionalAttrs (host.tier != "prod") { tier = host.tier; })
// (lib.optionalAttrs (host.priority != "high") { priority = host.priority; }) // (lib.optionalAttrs (host.priority != "high") { priority = host.priority; })
// (lib.optionalAttrs (host.role != null) { role = host.role; }) // (lib.optionalAttrs (host.role != null) { role = host.role; })
// host.labels; // host.labels;