about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorOliver Charles <ollie@ocharles.org.uk>2017-11-17 10:15:37 +0000
committerOliver Charles <ollie@ocharles.org.uk>2017-11-17 10:15:37 +0000
commitf0334c03363ae5a43028383ee7cb95edba40e239 (patch)
treefb8e4963020b8c835a6530c971e6bce7039120f6 /nixos/modules
parent9e44d34be28a270fd68161e96e335f4d6e2ba6fc (diff)
downloadnixlib-f0334c03363ae5a43028383ee7cb95edba40e239.tar
nixlib-f0334c03363ae5a43028383ee7cb95edba40e239.tar.gz
nixlib-f0334c03363ae5a43028383ee7cb95edba40e239.tar.bz2
nixlib-f0334c03363ae5a43028383ee7cb95edba40e239.tar.lz
nixlib-f0334c03363ae5a43028383ee7cb95edba40e239.tar.xz
nixlib-f0334c03363ae5a43028383ee7cb95edba40e239.tar.zst
nixlib-f0334c03363ae5a43028383ee7cb95edba40e239.zip
nixos/prometheus: add scrape_configs.honor_labels
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/monitoring/prometheus/default.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix
index c12b5f35dea3..2b7f88a538c1 100644
--- a/nixos/modules/services/monitoring/prometheus/default.nix
+++ b/nixos/modules/services/monitoring/prometheus/default.nix
@@ -100,6 +100,29 @@ let
           The HTTP resource path on which to fetch metrics from targets.
         '';
       };
+      honor_labels = mkOption {
+        type = types.bool;
+        default = false;
+        description = ''
+          Controls how Prometheus handles conflicts between labels
+          that are already present in scraped data and labels that
+          Prometheus would attach server-side ("job" and "instance"
+          labels, manually configured target labels, and labels
+          generated by service discovery implementations).
+
+          If honor_labels is set to "true", label conflicts are
+          resolved by keeping label values from the scraped data and
+          ignoring the conflicting server-side labels.
+
+          If honor_labels is set to "false", label conflicts are
+          resolved by renaming conflicting labels in the scraped data
+          to "exported_<original-label>" (for example
+          "exported_instance", "exported_job") and then attaching
+          server-side labels. This is useful for use cases such as
+          federation, where all labels specified in the target should
+          be preserved.
+        '';
+      };
       scheme = mkOption {
         type = types.enum ["http" "https"];
         default = "http";