From e8d3c37f2c1b71efcc0ae65ece13283173f6c32e Mon Sep 17 00:00:00 2001 From: Jan Wozniak Date: Fri, 12 Apr 2024 11:47:49 +0200 Subject: [PATCH] fix keda_scaler_error_total duplicate metric Signed-off-by: Jan Wozniak --- config/grafana/keda-dashboard.json | 4 ++-- pkg/metricscollector/prommetrics.go | 32 ++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/config/grafana/keda-dashboard.json b/config/grafana/keda-dashboard.json index 109a8bf7d93..afcb3d4f0bb 100644 --- a/config/grafana/keda-dashboard.json +++ b/config/grafana/keda-dashboard.json @@ -173,7 +173,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "sum by(job) (rate(keda_scaler_errors_total{}[5m]))", + "expr": "sum by(job) (rate(keda_scaler_detail_errors_total{}[5m]))", "legendFormat": "{{ job }}", "range": true, "refId": "A" @@ -313,7 +313,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "sum by(scaler) (rate(keda_scaler_errors_total{exported_namespace=~\"$namespace\", scaledObject=~\"$scaledObject\", scaler=~\"$scaler\"}[5m]))", + "expr": "sum by(scaler) (rate(keda_scaler_detail_errors_total{exported_namespace=~\"$namespace\", scaledObject=~\"$scaledObject\", scaler=~\"$scaler\"}[5m]))", "legendFormat": "{{ scaler }}", "range": true, "refId": "A" diff --git a/pkg/metricscollector/prommetrics.go b/pkg/metricscollector/prommetrics.go index acd4d95cc2c..01049b33af3 100644 --- a/pkg/metricscollector/prommetrics.go +++ b/pkg/metricscollector/prommetrics.go @@ -41,15 +41,6 @@ var ( }, []string{"version", "git_commit", "goversion", "goos", "goarch"}, ) - scalerErrorsTotalDeprecated = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Namespace: DefaultPromMetricsNamespace, - Subsystem: "scaler", - Name: "errors_total", - Help: "DEPRECATED - will be removed in 2.16 - use a `sum(scaler_errors_total{scaler!=\"\"})` over all scalers", - }, - []string{}, - ) scalerMetricsValue = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: DefaultPromMetricsNamespace, @@ -64,7 +55,7 @@ var ( Namespace: DefaultPromMetricsNamespace, Subsystem: "scaler", Name: "metrics_latency", - Help: "DEPRECATED - will be removed in 2.16 use 'scaler_metrics_latency_seconds' instead.", + Help: "DEPRECATED - will be removed in 2.16 use 'keda_scaler_metrics_latency_seconds' instead.", }, metricLabels, ) @@ -100,15 +91,24 @@ var ( Namespace: DefaultPromMetricsNamespace, Subsystem: "scaler", Name: "errors", - Help: "DEPRECATED - will be removed in 2.16 - use 'scaler_errors_total' instead.", + Help: "DEPRECATED - will be removed in 2.16 - use 'keda_scaler_detail_errors_total' instead.", }, metricLabels, ) - scalerErrors = prometheus.NewCounterVec( + scalerErrorsTotalDeprecated = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: DefaultPromMetricsNamespace, Subsystem: "scaler", Name: "errors_total", + Help: "DEPRECATED - will be removed in 2.16 - use a `sum(keda_scaler_detail_errors_total{scaler!=\"\"})` over all scalers", + }, + []string{}, + ) + scalerErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Namespace: DefaultPromMetricsNamespace, + Subsystem: "scaler", + Name: "detail_errors_total", Help: "The total number of errors encountered for each scaler.", }, metricLabels, @@ -118,7 +118,7 @@ var ( Namespace: DefaultPromMetricsNamespace, Subsystem: "scaled_object", Name: "errors", - Help: "DEPRECATED - will be removed in 2.16 - use 'scaled_object_errors_total' instead.", + Help: "DEPRECATED - will be removed in 2.16 - use 'keda_scaled_object_errors_total' instead.", }, []string{"namespace", "scaledObject"}, ) @@ -147,7 +147,7 @@ var ( Namespace: DefaultPromMetricsNamespace, Subsystem: "trigger", Name: "totals", - Help: "DEPRECATED - will be removed in 2.16 - use 'trigger_registered_total' instead.", + Help: "DEPRECATED - will be removed in 2.16 - use 'keda_trigger_registered_total' instead.", }, []string{"type"}, ) @@ -165,7 +165,7 @@ var ( Namespace: DefaultPromMetricsNamespace, Subsystem: "resource", Name: "totals", - Help: "DEPRECATED - will be removed in 2.16 - use 'resource_handled_total' instead.", + Help: "DEPRECATED - will be removed in 2.16 - use 'keda_resource_handled_total' instead.", }, []string{"type", "namespace"}, ) @@ -183,7 +183,7 @@ var ( Namespace: DefaultPromMetricsNamespace, Subsystem: "internal_scale_loop", Name: "latency", - Help: "DEPRECATED - will be removed in 2.16 - use 'internal_scale_loop_latency_seconds' instead.", + Help: "DEPRECATED - will be removed in 2.16 - use 'keda_internal_scale_loop_latency_seconds' instead.", }, []string{"namespace", "type", "resource"}, )