Skip to content

Commit 29296be

Browse files
authored
Convert autoscaling structured logging from strings to numbers (#2012)
1 parent 9352ac8 commit 29296be

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

pkg/operator/lib/autoscaler/autoscaler.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323

2424
"github.com/cortexlabs/cortex/pkg/lib/errors"
2525
math2 "github.com/cortexlabs/cortex/pkg/lib/math"
26-
"github.com/cortexlabs/cortex/pkg/lib/strings"
2726
time2 "github.com/cortexlabs/cortex/pkg/lib/time"
2827
"github.com/cortexlabs/cortex/pkg/operator/config"
2928
"github.com/cortexlabs/cortex/pkg/operator/operator"
@@ -187,23 +186,23 @@ func AutoscaleFn(initialDeployment *kapps.Deployment, apiSpec *spec.API, getInFl
187186

188187
apiLogger.Debugw(fmt.Sprintf("%s autoscaler tick", apiName),
189188
"autoscaling", map[string]interface{}{
190-
"avg_in_flight": strings.Round(*avgInFlight, 2, 0),
191-
"target_replica_concurrency": strings.Float64(*autoscalingSpec.TargetReplicaConcurrency),
192-
"raw_recommendation": strings.Round(rawRecommendation, 2, 0),
189+
"avg_in_flight": *avgInFlight,
190+
"target_replica_concurrency": *autoscalingSpec.TargetReplicaConcurrency,
191+
"raw_recommendation": rawRecommendation,
193192
"current_replicas": currentReplicas,
194-
"downscale_tolerance": strings.Float64(autoscalingSpec.DownscaleTolerance),
195-
"upscale_tolerance": strings.Float64(autoscalingSpec.UpscaleTolerance),
196-
"max_downscale_factor": strings.Float64(autoscalingSpec.MaxDownscaleFactor),
193+
"downscale_tolerance": autoscalingSpec.DownscaleTolerance,
194+
"upscale_tolerance": autoscalingSpec.UpscaleTolerance,
195+
"max_downscale_factor": autoscalingSpec.MaxDownscaleFactor,
197196
"downscale_factor_floor": downscaleFactorFloor,
198-
"max_upscale_factor": strings.Float64(autoscalingSpec.MaxUpscaleFactor),
197+
"max_upscale_factor": autoscalingSpec.MaxUpscaleFactor,
199198
"upscale_factor_ceil": upscaleFactorCeil,
200199
"min_replicas": autoscalingSpec.MinReplicas,
201200
"max_replicas": autoscalingSpec.MaxReplicas,
202201
"recommendation": recommendation,
203-
"downscale_stabilization_period": autoscalingSpec.DownscaleStabilizationPeriod,
204-
"downscale_stabilization_floor": strings.ObjFlatNoQuotes(downscaleStabilizationFloor),
205-
"upscale_stabilization_period": autoscalingSpec.UpscaleStabilizationPeriod,
206-
"upscale_stabilization_ceil": strings.ObjFlatNoQuotes(upscaleStabilizationCeil),
202+
"downscale_stabilization_period": autoscalingSpec.DownscaleStabilizationPeriod.Seconds(),
203+
"downscale_stabilization_floor": downscaleStabilizationFloor,
204+
"upscale_stabilization_period": autoscalingSpec.UpscaleStabilizationPeriod.Seconds(),
205+
"upscale_stabilization_ceil": upscaleStabilizationCeil,
207206
"request": request,
208207
},
209208
)

0 commit comments

Comments
 (0)