From 40e1584bc52f8753296e07a562265a034bf35bef Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Mon, 22 Jan 2024 15:40:19 -0500 Subject: [PATCH] =?UTF-8?q?fix(metrics):=20use=20Milli=20resource=20for=20?= =?UTF-8?q?cpu=20when=20allocating=20provider=20met=E2=80=A6=20(#112)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(metrics): use Milli resource for cpu when allocating provider metrics Signed-off-by: Artur Troian --- go/provider/v1/metrics.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go/provider/v1/metrics.go b/go/provider/v1/metrics.go index c03e0c7f..28ce031e 100644 --- a/go/provider/v1/metrics.go +++ b/go/provider/v1/metrics.go @@ -9,7 +9,7 @@ import ( func NewResourcesMetric() ResourcesMetric { return ResourcesMetric{ - CPU: resource.NewQuantity(0, "m"), + CPU: resource.NewMilliQuantity(0, resource.DecimalSI), Memory: resource.NewQuantity(0, resource.DecimalSI), GPU: resource.NewQuantity(0, resource.DecimalSI), EphemeralStorage: resource.NewQuantity(0, resource.DecimalSI), @@ -18,7 +18,7 @@ func NewResourcesMetric() ResourcesMetric { } func (inv *ResourcesMetric) AddResources(res types.Resources) { if res.CPU != nil { - qcpu := *resource.NewQuantity(res.CPU.Units.Val.Int64(), "m") + qcpu := *resource.NewMilliQuantity(res.CPU.Units.Val.Int64(), resource.DecimalSI) inv.CPU.Add(qcpu) } @@ -47,7 +47,7 @@ func (inv *ResourcesMetric) AddResourceUnit(res dtypes.ResourceUnit) { val := res.CPU.Units.Dup() val.Val.MulRaw(int64(res.Count)) - qcpu := *resource.NewQuantity(val.Val.Int64(), "m") + qcpu := *resource.NewMilliQuantity(val.Val.Int64(), resource.DecimalSI) inv.CPU.Add(qcpu) }