From 98cdcdfe3020bbd84697fd70ffd8748aaaf8f15e Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Thu, 4 Jan 2024 09:16:20 -0600 Subject: [PATCH] v-m/scrape: Stable instance label for Longhorn By default, the `instance` label for discovered metrics targets is set to the scrape address. For Kubernetes pods, that is the IP address and port of the pod, which naturally changes every time the pod is recreated or moved. This will cause a high churn rate for Longhorn manager pods. To avoid this, we set the `instance` label to the name of the node the pod is running on, which will not change because the Longhorn manager pods are managed by a DaemonSet. --- victoria-metrics/scrape.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/victoria-metrics/scrape.yml b/victoria-metrics/scrape.yml index 2ed6dc2..22aa3bf 100644 --- a/victoria-metrics/scrape.yml +++ b/victoria-metrics/scrape.yml @@ -257,6 +257,9 @@ scrape_configs: source_labels: - __meta_kubernetes_pod_container_init regex: '^true$' + - target_label: instance + source_labels: + - __meta_kubernetes_pod_node_name - job_name: zincati metrics_path: /bridge?selector=zincati