From 2074409c8652cd176202965a7d38649c8f3f79f4 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Tue, 10 Oct 2023 00:42:05 +0200 Subject: nixos/thanos: add query-frontend SystemD service --- nixos/modules/services/monitoring/thanos.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'nixos/modules/services/monitoring/thanos.nix') diff --git a/nixos/modules/services/monitoring/thanos.nix b/nixos/modules/services/monitoring/thanos.nix index e6d8afc66624f..872916931f94a 100644 --- a/nixos/modules/services/monitoring/thanos.nix +++ b/nixos/modules/services/monitoring/thanos.nix @@ -430,6 +430,12 @@ let ''; }; + query-frontend = params.common cfg.query-frontend // { + query-frontend.downstream-url = mkParamDef types.str "http://localhost:9090" '' + URL of downstream Prometheus Query compatible API. + ''; + }; + rule = params.common cfg.rule // params.objstore cfg.rule // { labels = mkAttrsParam "label" '' @@ -684,6 +690,13 @@ in { arguments = mkArgumentsOption "query"; }; + query-frontend = paramsToOptions params.query-frontend // { + enable = mkEnableOption + (lib.mdDoc ("the Thanos query frontend implements a service deployed in front of queriers to + improve query parallelization and caching.")); + arguments = mkArgumentsOption "query-frontend"; + }; + rule = paramsToOptions params.rule // { enable = mkEnableOption (lib.mdDoc ("the Thanos ruler service which evaluates Prometheus rules against" + @@ -768,6 +781,18 @@ in { }; }) + (mkIf cfg.query-frontend.enable { + systemd.services.thanos-query-frontend = { + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + serviceConfig = { + DynamicUser = true; + Restart = "always"; + ExecStart = thanos "query-frontend"; + }; + }; + }) + (mkIf cfg.rule.enable (mkMerge [ (assertRelativeStateDir "rule") { -- cgit 1.4.1