From ccbaae766f073557f9146cdcf815fae6ea49b382 Mon Sep 17 00:00:00 2001 From: tzwang Date: Tue, 2 Sep 2025 15:09:39 +0800 Subject: [PATCH] update octopushttp --- internal/storeLink/octopusHttp/octopusHttp.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/internal/storeLink/octopusHttp/octopusHttp.go b/internal/storeLink/octopusHttp/octopusHttp.go index 1d7b23c4..99f9015f 100644 --- a/internal/storeLink/octopusHttp/octopusHttp.go +++ b/internal/storeLink/octopusHttp/octopusHttp.go @@ -1110,15 +1110,25 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector. var cpuCore int64 var memGi int64 + // card + if cNum == "" { + return nil, nil + } cardNum, err := strconv.ParseInt(cNum, 10, 64) if err != nil { - cardNum = 0 + return nil, nil + } + + // cpu + if s.ResourceQuantity.Cpu == "" { + return nil, nil } cpuCore, err = strconv.ParseInt(s.ResourceQuantity.Cpu, 10, 64) if err != nil { - cpuCore = 0 + return nil, nil } + //memory if s.ResourceQuantity.Memory != "" { gi := strings.Split(s.ResourceQuantity.Memory, Gi) if len(gi) != 2 { @@ -1132,7 +1142,7 @@ func genClusterResources(cType string, cNum string, s *omodel.Spec) (*collector. memGi = mGi } } else { - memGi = 0 + return nil, nil } card := &collector.Usage{