Skip to content

Commit

Permalink
fix: conflicting types of log fields in json output
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
msvticket committed Mar 12, 2024
1 parent 0bcb2d3 commit c84bbc8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Here is an overview of all new **experimental** features:

### Fixes

- **General**: Log field ScaledJob no longer have conflicting types ([#5592](https://github.com/kedacore/keda/pull/5592))
- **General**: Validate empty array value of triggers in ScaledObject/ScaledJob creation ([#5520](https://github.com/kedacore/keda/issues/5520))

### Deprecations
Expand Down
4 changes: 2 additions & 2 deletions pkg/scaling/scale_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,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)

Expand Down Expand Up @@ -880,7 +880,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
}

Expand Down

0 comments on commit c84bbc8

Please sign in to comment.