nixos/prometheus: add retentionTime

This commit is contained in:
Robin Gloster 2019-09-21 14:50:08 +02:00 committed by Linus Heckemann
parent 1179840f9a
commit 5c0a2e8c60

View File

@ -49,8 +49,8 @@ let
"--web.listen-address=${cfg.listenAddress}:${builtins.toString cfg.port}"
"--alertmanager.notification-queue-capacity=${toString cfg.alertmanagerNotificationQueueCapacity}"
"--alertmanager.timeout=${toString cfg.alertmanagerTimeout}s"
] ++
optional (cfg.webExternalUrl != null) "--web.external-url=${cfg.webExternalUrl}";
] ++ optional (cfg.webExternalUrl != null) "--web.external-url=${cfg.webExternalUrl}"
++ optional (cfg.retentionTime != null) "--storage.tsdb.retention.time=${cfg.retentionTime}";
filterValidPrometheus = filterAttrsListRecursive (n: v: !(n == "_module" || v == null));
filterAttrsListRecursive = pred: x:
@ -624,6 +624,15 @@ in {
errors, despite a correct configuration.
'';
};
retentionTime = mkOption {
type = types.nullOr types.str;
default = null;
example = "15d";
description = ''
How long to retain samples in storage.
'';
};
};
config = mkIf cfg.enable {