Skip to content

Commit

Permalink
fix(provider/metrics): inplace edits don't work for big int (#127)
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian authored Mar 4, 2024
1 parent fdac575 commit 85b036a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go/provider/v1/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,31 @@ 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)
}

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)
}

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)
}

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)

Expand Down

0 comments on commit 85b036a

Please sign in to comment.