Skip to content

Commit 3f5abff

Browse files
committed
sending TargetSizeFloat in the payload
Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
1 parent 6ab5901 commit 3f5abff

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

scaler/handlers.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ func (e *impl) GetMetricSpec(
143143
res := &externalscaler.GetMetricSpecResponse{
144144
MetricSpecs: []*externalscaler.MetricSpec{
145145
{
146-
MetricName: kedaMetricName,
147-
TargetSize: targetValue,
146+
MetricName: kedaMetricName,
147+
TargetSizeFloat: targetValue,
148+
// when both are sent, the TargetSizeFloat has precedence (sending the old one for backward compat)
149+
TargetSize: int64(math.Ceil(targetValue)),
148150
},
149151
},
150152
}

util/handler_specific.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ func GetOperationOvertTime(lggr logr.Logger, metadata map[string]string) types.O
5454
return types.OperationOverTime(operationOverTime)
5555
}
5656

57-
func GetTargetValue(metadata map[string]string) (int64, error) {
57+
func GetTargetValue(metadata map[string]string) (float64, error) {
5858
targetValueStr, found := metadata[MetadataTargetValue]
5959
if !found {
6060
return -1, fmt.Errorf("not found %s", MetadataTargetValue)
6161
}
62-
targetValue, err := strconv.ParseInt(targetValueStr, 10, 64)
62+
targetValue, err := strconv.ParseFloat(targetValueStr, 64)
6363
if err != nil {
6464
return -1, err
6565
}

0 commit comments

Comments
 (0)