From 1e421889e4f361d61621075b69913c23c892f32c Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Sun, 6 Oct 2024 11:03:53 +0200 Subject: [PATCH] feat(monitoring): add static label for tenancy So we can distinguish easily things in the dashboards. Signed-off-by: Raito Bezarius --- flake.nix | 2 ++ services/monitoring/agent.nix | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index f3ae25f..cefcac6 100644 --- a/flake.nix +++ b/flake.nix @@ -127,6 +127,7 @@ deployment.tags = lib.mkIf (config.bagel.baremetal.builders.enable -> !config.bagel.baremetal.builders.netboot) [ "localboot" ]; + bagel.monitoring.grafana-agent.tenant = "floral"; bagel.secrets.tenant = "floral"; bagel.builders.extra-build-capacity.provider.tenant = "floral"; }) @@ -155,6 +156,7 @@ deployment.tags = [ "localboot" ]; + bagel.monitoring.grafana-agent.tenant = "lix"; bagel.secrets.tenant = "lix"; bagel.builders.extra-build-capacity.provider.tenant = "lix"; } diff --git a/services/monitoring/agent.nix b/services/monitoring/agent.nix index 9bb29a1..99c44ac 100644 --- a/services/monitoring/agent.nix +++ b/services/monitoring/agent.nix @@ -12,6 +12,14 @@ in options.bagel.monitoring.grafana-agent = { enable = (mkEnableOption "Grafana Agent") // { default = true; }; + tenant = mkOption { + description = '' + Which tenant are we enabling Grafana Agent for. + ''; + example = "lix"; + type = types.enum [ "lix" "floral" ]; + }; + exporters = mkOption { description = '' Set of additional exporters to scrape. @@ -76,7 +84,10 @@ in }; } ]; - global.external_labels.hostname = config.networking.hostName; + global.external_labels = { + hostname = config.networking.hostName; + inherit (cfg) tenant; + }; configs = [ { name = config.networking.hostName;