From 1649adc155e8a8296775a9f859df0a77945714a6 Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Mon, 2 Dec 2024 22:17:20 +0100 Subject: [PATCH] nixos/prometheus: add fallback_scrape_protocol and scrape_protocols options I chose to not constrain them to the supported values to be more flexible in supporting any newly added values. But maybe it makes sense to constrain them, I'm not completely sure. Ran into this because Prometheus 3.0 was introduced last week and my config broke, since rtl_433 doesn't set the headers / content-type correctly. Related-to: https://github.com/NixOS/nixpkgs/pull/358862 Related-to: https://github.com/prometheus/prometheus/pull/15136 --- .../modules/services/monitoring/prometheus/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix index 01e7a73667097..285b9e96924de 100644 --- a/nixos/modules/services/monitoring/prometheus/default.nix +++ b/nixos/modules/services/monitoring/prometheus/default.nix @@ -274,6 +274,7 @@ let }; }; + # https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config promTypes.scrape_config = types.submodule { options = { authorization = mkOption { @@ -299,6 +300,15 @@ let globally configured default. ''; + scrape_protocols = mkOpt (types.listOf types.str) '' + The protocols to negotiate during a scrape with the client. + ''; + + fallback_scrape_protocol = mkOpt types.str '' + Fallback protocol to use if a scrape returns blank, unparseable, or otherwise + invalid Content-Type. + ''; + metrics_path = mkDefOpt types.str "/metrics" '' The HTTP resource path on which to fetch metrics from targets. '';