mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(cloudmon): optimize service metric collect (#21847)
This commit is contained in:
@@ -17,7 +17,7 @@ package misc
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -74,7 +74,11 @@ func CollectServiceMetrics(ctx context.Context, userCred mcclient.TokenCredentia
|
||||
}
|
||||
metrics := []influxdb.SMetricData{}
|
||||
for _, ep := range endpoints {
|
||||
if utils.IsInStringArray(ep.ServiceType, apis.NO_RESOURCE_SERVICES) || ep.ServiceType == apis.SERVICE_TYPE_IMAGE {
|
||||
if utils.IsInStringArray(ep.ServiceType, apis.NO_RESOURCE_SERVICES) || utils.IsInStringArray(ep.ServiceType, []string{
|
||||
apis.SERVICE_TYPE_IMAGE,
|
||||
apis.SERVICE_TYPE_MONITOR,
|
||||
apis.SERVICE_TYPE_VICTORIA_METRICS,
|
||||
}) {
|
||||
continue
|
||||
}
|
||||
url := httputils.JoinPath(ep.Url, "version")
|
||||
@@ -90,7 +94,7 @@ func CollectServiceMetrics(ctx context.Context, userCred mcclient.TokenCredentia
|
||||
continue
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
version, _ := ioutil.ReadAll(resp.Body)
|
||||
version, _ := io.ReadAll(resp.Body)
|
||||
if len(version) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user