From 85b036a1fe63c4833e8d9f0f2c3974c496e9946f Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Mon, 4 Mar 2024 13:34:32 -0500 Subject: [PATCH] fix(provider/metrics): inplace edits don't work for big int (#127) Signed-off-by: Artur Troian --- go/provider/v1/metrics.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/go/provider/v1/metrics.go b/go/provider/v1/metrics.go index 28ce031e..7764e5c0 100644 --- a/go/provider/v1/metrics.go +++ b/go/provider/v1/metrics.go @@ -45,7 +45,7 @@ func (inv *ResourcesMetric) AddResources(res types.Resources) { func (inv *ResourcesMetric) AddResourceUnit(res dtypes.ResourceUnit) { if res.CPU != nil { val := res.CPU.Units.Dup() - val.Val.MulRaw(int64(res.Count)) + val.Val = val.Val.MulRaw(int64(res.Count)) qcpu := *resource.NewMilliQuantity(val.Val.Int64(), resource.DecimalSI) inv.CPU.Add(qcpu) @@ -53,7 +53,7 @@ func (inv *ResourcesMetric) AddResourceUnit(res dtypes.ResourceUnit) { if res.GPU != nil { val := res.GPU.Units.Dup() - val.Val.MulRaw(int64(res.Count)) + val.Val = val.Val.MulRaw(int64(res.Count)) qgpu := *resource.NewQuantity(val.Val.Int64(), resource.DecimalSI) inv.GPU.Add(qgpu) @@ -61,7 +61,7 @@ func (inv *ResourcesMetric) AddResourceUnit(res dtypes.ResourceUnit) { if res.Memory != nil { val := res.Memory.Quantity.Dup() - val.Val.MulRaw(int64(res.Count)) + val.Val = val.Val.MulRaw(int64(res.Count)) qmem := *resource.NewQuantity(val.Val.Int64(), resource.DecimalSI) inv.Memory.Add(qmem) @@ -69,7 +69,7 @@ func (inv *ResourcesMetric) AddResourceUnit(res dtypes.ResourceUnit) { for _, storage := range res.Storage { val := storage.Quantity.Dup() - val.Val.MulRaw(int64(res.Count)) + val.Val = val.Val.MulRaw(int64(res.Count)) qstorage := *resource.NewQuantity(val.Val.Int64(), resource.DecimalSI)