Skip to content

Commit

Permalink
fix: fix slice init length (#6179)
Browse files Browse the repository at this point in the history
Signed-off-by: cuishuang <imcusg@gmail.com>
  • Loading branch information
cuishuang authored Sep 24, 2024
1 parent 4444aca commit f196765
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/keda/scaledjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func (r *ScaledJobReconciler) updatePromMetrics(scaledJob *kedav1alpha1.ScaledJo
metricscollector.IncrementCRDTotal(metricscollector.ScaledJobResource, scaledJob.Namespace)
metricsData.namespace = scaledJob.Namespace

triggerTypes := make([]string, len(scaledJob.Spec.Triggers))
triggerTypes := make([]string, 0, len(scaledJob.Spec.Triggers))
for _, trigger := range scaledJob.Spec.Triggers {
metricscollector.IncrementTriggerTotal(trigger.Type)
triggerTypes = append(triggerTypes, trigger.Type)
Expand Down
2 changes: 1 addition & 1 deletion controllers/keda/scaledobject_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ func (r *ScaledObjectReconciler) updatePromMetrics(scaledObject *kedav1alpha1.Sc
metricscollector.IncrementCRDTotal(metricscollector.ScaledObjectResource, scaledObject.Namespace)
metricsData.namespace = scaledObject.Namespace

triggerTypes := make([]string, len(scaledObject.Spec.Triggers))
triggerTypes := make([]string, 0, len(scaledObject.Spec.Triggers))
for _, trigger := range scaledObject.Spec.Triggers {
metricscollector.IncrementTriggerTotal(trigger.Type)
triggerTypes = append(triggerTypes, trigger.Type)
Expand Down

0 comments on commit f196765

Please sign in to comment.