feat(monitoring): customize metrics ingest path

This commit is contained in:
arcnmx 2024-05-31 16:56:54 -07:00
parent f271f1ae00
commit f97ab24f47
2 changed files with 12 additions and 4 deletions

View file

@ -5,8 +5,8 @@
...
}: let
inherit (gensokyo-zone) systems;
inherit (gensokyo-zone.lib) mkAddress6;
inherit (lib.modules) mkDefault;
inherit (gensokyo-zone.lib) mkAddress6 mapOptionDefaults;
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
inherit (lib.attrsets) attrValues;
inherit (lib.lists) filter concatMap;
nodeExporterSystems =
@ -35,7 +35,12 @@
static_configs = [
{
inherit targets;
labels = mkDefault service.prometheus.exporter.labels;
labels = mkMerge [
(mapOptionDefaults service.prometheus.exporter.labels)
(mkIf (service.prometheus.exporter.metricsPath != "/metrics") {
__metrics_path__ = mkOptionDefault service.prometheus.exporter.metricsPath;
})
];
}
];
};

View file

@ -28,6 +28,10 @@ let
labels = mkOption {
type = attrsOf str;
};
metricsPath = mkOption {
type = str;
default = "/metrics";
};
};
};
ports = mkOption {
@ -183,7 +187,6 @@ in
};
};
promtail = {config, ...}: {
id = mkAlmostOptionDefault "promtail";
nixos = {
serviceAttr = "promtail";
assertions = mkIf config.enable [