From 2a69662ba2db746a27123f1fbdb9f4634b431f8d Mon Sep 17 00:00:00 2001 From: zhenyus Date: Sat, 8 Mar 2025 15:07:54 +0800 Subject: [PATCH] feat: enhance Redis metrics with additional alerts and labels in production configuration Signed-off-by: zhenyus --- .../3rd/redis-cluster/values.prod.yaml | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/freeleaps/helm-pkg/3rd/redis-cluster/values.prod.yaml b/freeleaps/helm-pkg/3rd/redis-cluster/values.prod.yaml index e050b7c4..18e06efb 100644 --- a/freeleaps/helm-pkg/3rd/redis-cluster/values.prod.yaml +++ b/freeleaps/helm-pkg/3rd/redis-cluster/values.prod.yaml @@ -1076,8 +1076,9 @@ metrics: ## prometheusRule: enabled: true - additionalLabels: {} - namespace: "" + additionalLabels: + release: kube-prometheus-stack + namespace: "freeleaps-monitoring-system" ## These are just examples rules, please adapt them to your needs. ## Make sure to constraint the rules to the current postgresql service. ## - alert: RedisDown @@ -1109,7 +1110,35 @@ metrics: ## summary: Redis® instance {{ "{{ $instance }}" }} has evicted keys ## description: Redis® instance {{ "{{ $instance }}" }} has evicted {{ "{{ $value }}" }} keys in the last 5 minutes. ## - rules: [] + rules: + - alert: RedisDown + expr: redis_up{service="{{ template "common.names.fullname" . }}-metrics"} == 0 + for: 2m + labels: + severity: error + annotations: + summary: Redis® instance {{ "{{ $instance }}" }} down + description: Redis® instance {{ "{{ $instance }}" }} is down. + - alert: RedisMemoryHigh + expr: > + redis_memory_used_bytes{service="{{ template "common.names.fullname" . }}-metrics"} * 100 + / + redis_memory_max_bytes{service="{{ template "common.names.fullname" . }}-metrics"} + > 90 + for: 2m + labels: + severity: error + annotations: + summary: Redis® instance {{ "{{ $instance }}" }} is using too much memory + description: Redis® instance {{ "{{ $instance }}" }} is using {{ "{{ $value }}" }}% of its available memory. + - alert: RedisKeyEviction + expr: increase(redis_evicted_keys_total{service="{{ template "common.names.fullname" . }}-metrics"}[5m]) > 0 + for: 1s + labels: + severity: error + annotations: + summary: Redis® instance {{ "{{ $instance }}" }} has evicted keys + description: Redis® instance {{ "{{ $instance }}" }} has evicted {{ "{{ $value }}" }} keys in the last 5 minutes. ## @param metrics.priorityClassName Metrics exporter pod priorityClassName ## priorityClassName: ""