From 15cd56373268f7caa82a8e2dc1ed7c24db5c567a Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@private.storage>
Date: Mon, 2 Aug 2021 17:09:41 +0000
Subject: [PATCH] Also relabel the payments host name to remove the port number

We have to explicitely add the port number so the relabel
config can strip it out again.  Else, `instance' seems to
get its value from somewhere else - somewhere our relabel
config does not look at.
---
 nixos/modules/monitoring/server/prometheus.nix | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/nixos/modules/monitoring/server/prometheus.nix b/nixos/modules/monitoring/server/prometheus.nix
index c92261cc..1f27f023 100644
--- a/nixos/modules/monitoring/server/prometheus.nix
+++ b/nixos/modules/monitoring/server/prometheus.nix
@@ -59,7 +59,9 @@ in {
           scheme = "https";
           tls_config.insecure_skip_verify = true;
           static_configs = [{
-            targets = cfg.paymentExporterTargets;
+            # Explicitly setting the port number so the relabel_config can filter it out again.
+            # Leaving it out makes the port number show in Grafana.
+            targets = map (x: x + ":443") cfg.paymentExporterTargets;
           }];
           relabel_configs = [ dropPortNumber ];
         }
-- 
GitLab