From f288c01c0f2bc54db186ae4c43e02030719aaf83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Svantesson?= Date: Wed, 27 Mar 2024 16:59:33 +0100 Subject: [PATCH] fix: conflicting types of log fields in json output (#5592) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ScaledJob is an object in logs during setup, but a string later. So I change name to scaledJob.Name in the latter cases. Signed-off-by: Mårten Svantesson Signed-off-by: Mårten Svantesson Signed-off-by: Zbynek Roubalik Co-authored-by: Zbynek Roubalik --- CHANGELOG.md | 1 + pkg/scaling/scale_handler.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1fad714f2e..a0fb04c9e6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,7 @@ Here is an overview of all new **experimental** features: ### Fixes - **General**: Fix CVE-2024-28180 in github.com/go-jose/go-jose/v3 ([#5617](https://github.com/kedacore/keda/pull/5617)) +- **General**: Log field `ScaledJob` no longer have conflicting types ([#5592](https://github.com/kedacore/keda/pull/5592)) - **General**: Prometheus metrics shows errors correctly ([#5597](https://github.com/kedacore/keda/issues/5597)) - **General**: Validate empty array value of triggers in ScaledObject/ScaledJob creation ([#5520](https://github.com/kedacore/keda/issues/5520)) - **GitHub Runner Scaler**: Fixed `in_progress` detection on running jobs instead of just `queued` ([#5604](https://github.com/kedacore/keda/issues/5604)) diff --git a/pkg/scaling/scale_handler.go b/pkg/scaling/scale_handler.go index f297ffbd0e9..8d0acd5d38c 100644 --- a/pkg/scaling/scale_handler.go +++ b/pkg/scaling/scale_handler.go @@ -817,7 +817,7 @@ func (h *scaleHandler) getScaledJobMetrics(ctx context.Context, scaledJob *kedav isActive := false scalerType := fmt.Sprintf("%T:", scaler) - scalerLogger := log.WithValues("ScaledJob", scaledJob.Name, "Scaler", scalerType) + scalerLogger := log.WithValues("scaledJob.Name", scaledJob.Name, "Scaler", scalerType) metricSpecs := scaler.GetMetricSpecForScaling(ctx) @@ -881,7 +881,7 @@ func (h *scaleHandler) isScaledJobActive(ctx context.Context, scaledJob *kedav1a isActive, queueLength, maxValue, maxFloatValue := scaledjob.IsScaledJobActive(scalersMetrics, scaledJob.Spec.ScalingStrategy.MultipleScalersCalculation, scaledJob.MinReplicaCount(), scaledJob.MaxReplicaCount()) - logger.V(1).WithValues("ScaledJob", scaledJob.Name).Info("Checking if ScaleJob Scalers are active", "isActive", isActive, "maxValue", maxFloatValue, "MultipleScalersCalculation", scaledJob.Spec.ScalingStrategy.MultipleScalersCalculation) + logger.V(1).WithValues("scaledJob.Name", scaledJob.Name).Info("Checking if ScaleJob Scalers are active", "isActive", isActive, "maxValue", maxFloatValue, "MultipleScalersCalculation", scaledJob.Spec.ScalingStrategy.MultipleScalersCalculation) return isActive, queueLength, maxValue }