diff --git a/viz/charts/linkerd-viz/README.md b/viz/charts/linkerd-viz/README.md index 4be95d6469708..c445a8af397d1 100644 --- a/viz/charts/linkerd-viz/README.md +++ b/viz/charts/linkerd-viz/README.md @@ -141,6 +141,7 @@ Kubernetes: `>=1.22.0-0` | prometheus.image.tag | string | `"v2.48.1"` | Docker image tag for the prometheus instance | | prometheus.logFormat | string | defaultLogLevel | log format (plain, json) of the prometheus instance | | prometheus.logLevel | string | defaultLogLevel | log level of the prometheus instance | +| prometheus.metricRelabelConfigs | string | `nil` | A metricRelabelConfigs section allows to drop high cardinality metrics. *NOTE:* Please use with caution. Some metrics are needed for linkerd-viz to function properly. | | prometheus.nodeSelector | object | `{"kubernetes.io/os":"linux"}` | NodeSelector section, See the [K8S documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) for more information | | prometheus.podAnnotations | object | `{}` | annotations for the prometheus pod | | prometheus.proxy | string | `nil` | | diff --git a/viz/charts/linkerd-viz/templates/prometheus.yaml b/viz/charts/linkerd-viz/templates/prometheus.yaml index 9c2927d186e83..603c904f2a910 100644 --- a/viz/charts/linkerd-viz/templates/prometheus.yaml +++ b/viz/charts/linkerd-viz/templates/prometheus.yaml @@ -137,6 +137,10 @@ data: # Copy tmp labels into real labels - action: labelmap regex: __tmp_pod_label_(.+) + {{- if .Values.prometheus.metricRelabelConfigs }} + metric_relabel_configs: + {{- toYaml .Values.prometheus.metricRelabelConfigs | trim | nindent 6 }} + {{- end}} {{- if .Values.prometheus.scrapeConfigs }} {{- toYaml .Values.prometheus.scrapeConfigs | trim | nindent 4 }} diff --git a/viz/charts/linkerd-viz/values.yaml b/viz/charts/linkerd-viz/values.yaml index 4bac52526c6f4..1bdc851297f17 100644 --- a/viz/charts/linkerd-viz/values.yaml +++ b/viz/charts/linkerd-viz/values.yaml @@ -499,6 +499,18 @@ prometheus: # - action: labelmap # regex: __meta_kubernetes_node_label_(.+) + # -- A metricRelabelConfigs section allows to drop high cardinality metrics. + # *NOTE:* Please use with caution. Some metrics are needed for linkerd-viz to + # function properly. + metricRelabelConfigs: + # This allows us to fine tune prometheus cardinality by dropping certain + # metrics as suggested here: https://itnext.io/optimizing-linkerd-metrics-in-prometheus-de607ec10f6b + # + # Ex: + # - action: keep + # source_labels: [le] + # regex: "(?i)(|10|50|100|500|1000|10000|30000|\\+Inf)" + # -- A sidecarContainers section specifies a list of secondary containers to run # in the prometheus pod e.g. to export data to non-prometheus systems sidecarContainers: