Skip to content

Commit 2e220ce

Browse files
authored
[loki] Make ServiceMonitor jobPrefix configurable (#192)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
1 parent 815140f commit 2e220ce

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

charts/loki/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: loki
33
description: Helm chart for Grafana Loki supporting monolithic, simple scalable, and microservices modes.
44
type: application
55
appVersion: 3.6.7
6-
version: 8.1.1
6+
version: 8.1.2
77
kubeVersion: ">=1.25.0-0"
88
home: https://grafana-community.github.io/helm-charts
99
sources:

charts/loki/templates/monitoring/servicemonitor.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ spec:
3838
scrapeTimeout: {{ . }}
3939
{{- end }}
4040
relabelings:
41+
{{- with .jobPrefix }}
4142
- sourceLabels: [job]
4243
action: replace
43-
replacement: "{{ include "loki.namespace" $ }}/$1"
44+
replacement: "{{ tpl . $}}$1"
4445
targetLabel: job
46+
{{- end }}
4547
- action: replace
4648
replacement: "{{ include "loki.clusterLabel" $ }}"
4749
targetLabel: cluster

charts/loki/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4364,6 +4364,9 @@ monitoring:
43644364
scheme: http
43654365
# -- ServiceMonitor will use these tlsConfig settings to make the health check requests
43664366
tlsConfig: null
4367+
# -- ServiceMonitor job label prefix will be used to generate the job label for the scraped metrics.
4368+
# -- The job label is required for the included dashboards to work.
4369+
jobPrefix: '{{ include "loki.namespace" $ }}/'
43674370
# -- DEPRECATED If defined, will create a MetricsInstance for the Grafana Agent Operator.
43684371
metricsInstance:
43694372
# -- If enabled, MetricsInstance resources for Grafana Agent Operator are created

0 commit comments

Comments
 (0)