From 804e1f4a2afaa4f58f74676967e17284f080a797 Mon Sep 17 00:00:00 2001 From: Idan Date: Thu, 17 Jan 2019 15:04:04 +0200 Subject: [PATCH] Fix pushgateway labels honoring (#10728) * add honorLabels to Pushgateway ServiceMonitor Signed-off-by: Idan Levin * Pushgateway chart version bump Signed-off-by: Idan Levin * update readme Signed-off-by: Idan Levin --- stable/prometheus-pushgateway/Chart.yaml | 2 +- stable/prometheus-pushgateway/README.md | 1 + stable/prometheus-pushgateway/templates/servicemonitor.yaml | 1 + stable/prometheus-pushgateway/values.yaml | 3 +++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/stable/prometheus-pushgateway/Chart.yaml b/stable/prometheus-pushgateway/Chart.yaml index 34d943d5f3..fdae63b857 100644 --- a/stable/prometheus-pushgateway/Chart.yaml +++ b/stable/prometheus-pushgateway/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "0.6.0" description: A Helm chart for prometheus pushgateway name: prometheus-pushgateway -version: 0.2.0 +version: 0.3.0 home: https://github.com/prometheus/pushgateway sources: - https://github.com/prometheus/pushgateway diff --git a/stable/prometheus-pushgateway/README.md b/stable/prometheus-pushgateway/README.md index 056aa3d7af..9a734c889d 100644 --- a/stable/prometheus-pushgateway/README.md +++ b/stable/prometheus-pushgateway/README.md @@ -66,6 +66,7 @@ The following table lists the configurable parameters of the pushgateway chart a | `serviceMonitor.namespace` | Namespace which Prometheus is running in | `monitoring` | | `serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` | | `serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` | +| `serviceMonitor.honorLabels`| if `true`, label conflicts are resolved by keeping label values from the scraped data | `true` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/stable/prometheus-pushgateway/templates/servicemonitor.yaml b/stable/prometheus-pushgateway/templates/servicemonitor.yaml index 0c25fa8904..2de77f68d8 100644 --- a/stable/prometheus-pushgateway/templates/servicemonitor.yaml +++ b/stable/prometheus-pushgateway/templates/servicemonitor.yaml @@ -16,6 +16,7 @@ spec: {{- if .Values.serviceMonitor.interval }} interval: {{ .Values.serviceMonitor.interval }} {{- end }} + honorLabels: {{ .Values.serviceMonitor.honorLabels }} selector: matchLabels: app: {{ template "prometheus-pushgateway.name" . }} diff --git a/stable/prometheus-pushgateway/values.yaml b/stable/prometheus-pushgateway/values.yaml index 9900bda6e2..cc06ed09bd 100644 --- a/stable/prometheus-pushgateway/values.yaml +++ b/stable/prometheus-pushgateway/values.yaml @@ -100,3 +100,6 @@ serviceMonitor: ## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters) selector: prometheus: kube-prometheus + # Retain the job and instance labels of the metrics pushed to the Pushgateway + # [Scraping Pushgateway](https://github.com/prometheus/pushgateway#configure-the-pushgateway-as-a-target-to-scrape) + honorLabels: true