diff options
author | Anthony Roussel <anthony@roussel.dev> | 2023-10-10 00:42:05 +0200 |
---|---|---|
committer | Anthony Roussel <anthony@roussel.dev> | 2023-11-12 11:08:51 +0100 |
commit | 2074409c8652cd176202965a7d38649c8f3f79f4 (patch) | |
tree | c7c8749d6a890a8d97f245283cba017567d5c657 /nixos/modules/services/monitoring/thanos.nix | |
parent | b2c956e071b25a4a4bbd9cf84978a2fdb9525794 (diff) |
nixos/thanos: add query-frontend SystemD service
Diffstat (limited to 'nixos/modules/services/monitoring/thanos.nix')
-rw-r--r-- | nixos/modules/services/monitoring/thanos.nix | 25 |
1 files changed, 25 insertions, 0 deletions
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") { |