Only keep metrics from the monitored namespaces
Signed-off-by: Michel Hollands <michel.hollands@gmail.com>
This commit is contained in:
parent
1871a4ef87
commit
c614f41d66
@ -6,6 +6,15 @@
|
||||
{{- join ", " $list }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "agent.all_namespaces" -}}
|
||||
{{- $list := list }}
|
||||
{{- range .Values.namespacesToMonitor }}
|
||||
{{- $list = append $list (printf "\"%s\"" .) }}
|
||||
{{- end }}
|
||||
{{- $list = append $list .Release.Namespace }}
|
||||
{{- join "|" $list }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "agent.loki_write_targets" -}}
|
||||
{{- $list := list }}
|
||||
{{- if .Values.local.logs.enabled }}
|
||||
|
@ -137,6 +137,13 @@ data:
|
||||
action = "keep"
|
||||
}
|
||||
|
||||
rule {
|
||||
source_labels = ["namespace"]
|
||||
regex = "{{ include "agent.all_namespaces" . }}""
|
||||
|
||||
action = "keep"
|
||||
}
|
||||
|
||||
forward_to = [ {{ include "agent.prometheus_write_targets" . }} ]
|
||||
}
|
||||
{{- if .Values.kubeStateMetrics.enabled }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user