diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index 56751a8e..f36d67dd 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -31,6 +31,23 @@ type ( centerType string `json:"centerType"` } ) + +type remoteResp { + code int `json:"code"` + message string `json:"message"` + data interface{} `json:"data"` +} + +type ( + clustersLoadReq { + adapterId int64 `form:"adapterId"` + clusterName string `form:"clusterName"` + } + clustersLoadResp { + data interface{} `json:"data"` + } +) + type ( syncClusterLoadReq { clusterLoadRecords []ClusterLoadRecord `json:"clusterLoadRecords"` @@ -40,13 +57,13 @@ type ( ClusterName string `json:"clusterName"` CpuAvail float64 `json:"cpuAvail"` CpuTotal float64 `json:"cpuTotal"` - CpuUsage float64 `json:"cpuUsage"` + CpuUtilisation float64 `json:"cpuUtilisation"` MemoryAvail float64 `json:"memoryAvail"` - MemoryUsage float64 `json:"memoryUsage"` + MemoryUtilisation float64 `json:"memoryUtilisation"` MemoryTotal float64 `json:"memoryTotal"` DiskAvail float64 `json:"diskAvail"` DiskTotal float64 `json:"diskTotal"` - DiskUsage float64 `json:"diskUsage"` + DiskUtilisation float64 `json:"diskUtilisation"` } ) @@ -417,28 +434,8 @@ type ( } ) - //jccSchedule容器集群资源监控 > start -type ClusterMetrics struct { - Code int `json:"code,omitempty"` - Msg string `json:"msg,omitempty"` - Data []MetricResult `json:"data,omitempty"` -} -type MetricResult struct { - MetricName string `json:"metric_name, omitempty"` - MetricData MetricData `json:"data, omitempty"` -} - -type MetricData struct { - Result []map[string]interface{} `json:"result"` - ResultType string `json:"resultType"` -} - -type ResultData struct { - Status string `json:"status"` - Data MetricData `json:"data"` -} type NodeAssetsResp { NodeAssets []NodeAsset `json:"nodeAssets"` diff --git a/api/desc/pcm.api b/api/desc/pcm.api index f18cb9d3..118d559d 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -23,7 +23,7 @@ info( //core端接口 @server( prefix: pcm/v1 - group : core + group: core ) service pcm { @doc "查询P端服务列表" @@ -42,6 +42,10 @@ service pcm { @handler commitVmTaskHandler post /core/commitVmTask (commitVmTaskReq) returns (commitVmTaskResp) + @doc "提交虚拟机任务临时" + @handler commitVmTaskTempHandler + post /core/commitVmTaskTemp (commitVmTaskReq) returns (commitVmTaskResp) + @doc "删除任务" @handler deleteTaskHandler delete /core/deleteTask/:id (deleteTaskReq) @@ -82,10 +86,6 @@ service pcm { @handler getGeneralInfoHandler get /core/getGeneralInfo returns (GiResp) - @doc "查询各域资源信息" - @handler listDomainResourceHandler - get /core/listDomainResource returns (DomainResourceResp) - @doc "查询控制面板配置信息" @handler getResourcePanelConfigHandler get /core/getResourcePanelConfigHandler returns (ResourcePanelConfigResp) @@ -104,7 +104,7 @@ service pcm { @doc "Center Resources top3" @handler centerResourcesHandler - get /core/centerResources returns (centerResourcesResp) + get /core/centerResources returns (centerResourcesResp) @doc "Synchronize Cluster Load Information" @handler syncClusterLoadHandler @@ -121,12 +121,20 @@ service pcm { @doc "provided to participant to push task info to core" @handler pushTaskInfoHandler post /core/pushTaskInfo (PushTaskInfoReq) returns (PushTaskInfoResp) + + @doc "alert rules" + @handler alertRulesHandler + get /core/alert/rules + + @doc "cluster resource load" + @handler clustersLoadHandler + get /core/cluster/load (clustersLoadReq) returns (clustersLoadResp) } //hpc二级接口 @server( prefix: pcm/v1 - group : hpc + group: hpc ) service pcm { @doc "提交超算任务" @@ -153,7 +161,7 @@ service pcm { //cloud二级接口 @server( prefix: pcm/v1 - group : cloud + group: cloud ) service pcm { @doc "云算任务列表" @@ -187,13 +195,12 @@ service pcm { @doc "Obtain cluster list information according to adapterId" @handler getClusterListHandler get /core/clusterList (getClusterListReq) returns (getClusterListResp) - } //智算二级接口 @server( prefix: pcm/v1 - group : ai + group: ai ) service pcm { @doc "查询数据集列表" @@ -281,7 +288,6 @@ service pcm { get /ai/ListClusters (ListClustersReq) returns (ListClustersResp) /******************Notebook Method start*************************/ - @doc "查询notebook列表" @handler listNotebookHandler get /ai/listNotebook (ListNotebookReq) returns (ListNotebookResp) @@ -305,12 +311,13 @@ service pcm { @doc "挂载notebook存储" @handler mountNotebookStorageHandler post /ai/mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp) - /******************Notebook Method end*************************/ + /******************Notebook Method end*************************/ /******************Visualization Job Method start*************************/ @doc "获取虚拟化任务" @handler getVisualizationJobHandler get /ai/getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp) + @doc "创建虚拟化任务" @handler createVisualizationJobHandler post /ai/CreateVisualizationJob (CreateVisualizationJobReq) returns (CreateVisualizationJobResp) @@ -320,15 +327,17 @@ service pcm { //screen接口 @server( prefix: pcm/v1 - group : storage + group: storage ) service pcm { @doc "存储概览" @handler screenStorageHandler get /storage/screenStorage (StorageScreenReq) returns (StorageScreenResp) + @doc "日常算力查询" @handler dailyPowerScreenHandler get /storage/dailyPowerScreen (DailyPowerScreenReq) returns (DailyPowerScreenResp) + @doc "算力中心算力情况" @handler perCenterComputerPowersHandler get /storage/perCenterComputerPowers (PerCenterComputerPowersReq) returns (PerCenterComputerPowersResp) @@ -337,7 +346,7 @@ service pcm { //镜像接口 @server( prefix: pcm/v1 - group : image + group: image ) service pcm { @doc "镜像上传" @@ -364,7 +373,7 @@ service pcm { //openstack 接口 @server( prefix: pcm/v1 - group : vm + group: vm ) service pcm { @doc "openstack计算中心概览" @@ -755,9 +764,8 @@ service pcm { //存算联动 接口 @server( prefix: pcm/v1 - group : storelink + group: storelink ) - service pcm { @handler UploadLinkImageHandler post /storelink/uploadImage (UploadLinkImageReq) returns (UploadLinkImageResp) @@ -787,7 +795,7 @@ service pcm { // 接口 @server( prefix: pcm/v1 - group : apps + group: apps ) service pcm { @doc "应用列表" @@ -830,9 +838,8 @@ service pcm { // 接口 @server( prefix: pcm/v1 - group : adapters + group: adapters ) - service pcm { @handler AdaptersListHandler get /adapter/list (AdapterQueryReq) returns (PageResult) @@ -873,9 +880,8 @@ service pcm { @server( prefix: pcm/v1 - group : schedule + group: schedule ) - service pcm { @handler ScheduleGetAiResourceTypesHandler get /schedule/ai/getResourceTypes returns (AiResourceTypesResp) @@ -889,15 +895,17 @@ service pcm { @handler ScheduleGetStrategyHandler get /schedule/ai/getStrategies returns (AiStrategyResp) + @handler ScheduleGetAlgorithmsHandler + get /schedule/ai/getAlgorithms (AiAlgorithmsReq) returns (AiAlgorithmsResp) + @handler ScheduleSubmitHandler post /schedule/submit (ScheduleReq) returns (ScheduleResp) } @server( prefix: pcm/v1 - group : dictionary + group: dictionary ) - service pcm { @handler GetDict get /dict/:id (CId) returns (DictResp) diff --git a/api/desc/schedule/pcm-schedule.api b/api/desc/schedule/pcm-schedule.api index 64e2a77d..d9946a33 100644 --- a/api/desc/schedule/pcm-schedule.api +++ b/api/desc/schedule/pcm-schedule.api @@ -41,4 +41,14 @@ type ( AiStrategyResp { Strategies []string `json:"strategies"` } + + AiAlgorithmsReq { + ResourceType string `json:"resourceType"` + TaskType string `json:"taskType"` + Dataset string `json:"dataset"` + } + + AiAlgorithmsResp { + Algorithms []string `json:"algorithms"` + } ) \ No newline at end of file diff --git a/api/desc/vm/pcm-vm.api b/api/desc/vm/pcm-vm.api index fd095a9b..361b86d4 100644 --- a/api/desc/vm/pcm-vm.api +++ b/api/desc/vm/pcm-vm.api @@ -321,7 +321,7 @@ type ( type ( CreateServerReq { Server Server `json:"server" copier:"Server"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } CreateServerResp { Server ServerResp `json:"server" copier:"Server"` @@ -748,7 +748,7 @@ type ( type ( CreateNetworkReq { Network CreateNetwork `json:"network" copier:"Network"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } CreateNetworkResp { Network Network `json:"network" copier:"Network"` @@ -766,7 +766,7 @@ type ( type ( CreateSubnetReq { Subnet Subnet `json:"subnet" copier:"Subnet"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } CreateSubnetResp { Subnet SubnetResp `json:"subnet" copier:"Subnet"` diff --git a/api/etc/pcm.yaml b/api/etc/pcm.yaml index 2e86edae..a1d8ac7d 100644 --- a/api/etc/pcm.yaml +++ b/api/etc/pcm.yaml @@ -11,11 +11,10 @@ Redis: Host: 10.206.0.12:6379 Pass: redisPW123 -Cache: - - Host: 10.206.0.12:6379 - Pass: redisPW123 +Monitoring: + PromUrl: http://47.92.39.128:30877 + AlertUrl: 47.92.39.128:32243 -PromUrl: http://47.92.39.128:30877 # k8s rpc K8sNativeConf: diff --git a/api/internal/config/config.go b/api/internal/config/config.go index 3debd22e..5ead1aa5 100644 --- a/api/internal/config/config.go +++ b/api/internal/config/config.go @@ -49,7 +49,11 @@ type Config struct { Password string } SnowflakeConf SnowflakeConf - PromUrl string + Monitoring Monitoring +} +type Monitoring struct { + PromUrl string + AlertUrl string } // SnowflakeConf 雪花算法机器id配置 diff --git a/api/internal/handler/core/alertruleshandler.go b/api/internal/handler/core/alertruleshandler.go new file mode 100644 index 00000000..fb7af106 --- /dev/null +++ b/api/internal/handler/core/alertruleshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func AlertRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewAlertRulesLogic(r.Context(), svcCtx) + err := l.AlertRules() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/clustersloadhandler.go b/api/internal/handler/core/clustersloadhandler.go new file mode 100644 index 00000000..e563ea8c --- /dev/null +++ b/api/internal/handler/core/clustersloadhandler.go @@ -0,0 +1,25 @@ +package core + +import ( + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ClustersLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClustersLoadReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewClustersLoadLogic(r.Context(), svcCtx) + resp, err := l.ClustersLoad(&req) + result.HttpResult(r, w, resp, err) + } +} diff --git a/api/internal/handler/core/commitvmtasktemphandler.go b/api/internal/handler/core/commitvmtasktemphandler.go new file mode 100644 index 00000000..6167ba5c --- /dev/null +++ b/api/internal/handler/core/commitvmtasktemphandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitVmTaskTempHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitVmTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewCommitVmTaskTempLogic(r.Context(), svcCtx) + resp, err := l.CommitVmTaskTemp(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go deleted file mode 100644 index 3b681ac3..00000000 --- a/api/internal/handler/core/listdomainresourcehandler.go +++ /dev/null @@ -1,16 +0,0 @@ -package core - -import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" -) - -func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewListDomainResourceLogic(r.Context(), svcCtx) - resp, err := l.ListDomainResource() - result.HttpResult(r, w, resp, err) - } -} diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go index 9a809c81..a75f4e5a 100644 --- a/api/internal/handler/routes.go +++ b/api/internal/handler/routes.go @@ -44,6 +44,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/core/commitVmTask", Handler: core.CommitVmTaskHandler(serverCtx), }, + { + Method: http.MethodPost, + Path: "/core/commitVmTaskTemp", + Handler: core.CommitVmTaskTempHandler(serverCtx), + }, { Method: http.MethodDelete, Path: "/core/deleteTask/:id", @@ -94,11 +99,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/core/getGeneralInfo", Handler: core.GetGeneralInfoHandler(serverCtx), }, - { - Method: http.MethodGet, - Path: "/core/listDomainResource", - Handler: core.ListDomainResourceHandler(serverCtx), - }, { Method: http.MethodGet, Path: "/core/getResourcePanelConfigHandler", @@ -144,6 +144,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/core/pushTaskInfo", Handler: core.PushTaskInfoHandler(serverCtx), }, + { + Method: http.MethodGet, + Path: "/core/alert/rules", + Handler: core.AlertRulesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/cluster/load", + Handler: core.ClustersLoadHandler(serverCtx), + }, }, rest.WithPrefix("/pcm/v1"), ) diff --git a/api/internal/logic/core/alertruleslogic.go b/api/internal/logic/core/alertruleslogic.go new file mode 100644 index 00000000..e5275dc3 --- /dev/null +++ b/api/internal/logic/core/alertruleslogic.go @@ -0,0 +1,33 @@ +package core + +import ( + "context" + "github.com/prometheus/alertmanager/api/v2/client/alert" + + "github.com/zeromicro/go-zero/core/logx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +type AlertRulesLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewAlertRulesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AlertRulesLogic { + return &AlertRulesLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *AlertRulesLogic) AlertRules() error { + // todo: add your logic here and delete this line + alerts, err := l.svcCtx.AlertClient.Alert.GetAlerts(&alert.GetAlertsParams{}) + if err != nil { + return err + } + println(alerts.Error()) + return nil +} diff --git a/api/internal/logic/core/centerresourceslogic.go b/api/internal/logic/core/centerresourceslogic.go index 5494ad27..d1bf0a24 100644 --- a/api/internal/logic/core/centerresourceslogic.go +++ b/api/internal/logic/core/centerresourceslogic.go @@ -46,20 +46,20 @@ func (l *CenterResourcesLogic) CenterResources() (resp *types.CenterResourcesRes for _, centerIndex := range centersIndex { // Query the types of resource centers l.svcCtx.DbEngin.Raw("select name,type as CenterType from t_adapter where id = ?", centerIndex.Id).Scan(¢erIndex) - cpuRawData, err := l.svcCtx.PromClient.GetRawData("center_cpu_usage", tracker.AdapterOption{AdapterId: centerIndex.Id}) + cpuRawData, err := l.svcCtx.PromClient.GetRawData("center_cpu_utilisation", tracker.AdapterOption{AdapterId: centerIndex.Id}) cpuData := cpuRawData.(model.Vector) if err != nil { return nil, err } centerIndex.Cpu = cpuData[0].Value.String() - memoryRawData, err := l.svcCtx.PromClient.GetRawData("center_memory_usage", tracker.AdapterOption{AdapterId: centerIndex.Id}) + memoryRawData, err := l.svcCtx.PromClient.GetRawData("center_memory_utilisation", tracker.AdapterOption{AdapterId: centerIndex.Id}) if err != nil { return nil, err } memoryData := memoryRawData.(model.Vector) centerIndex.Memory = memoryData[0].Value.String() - diskRawData, err := l.svcCtx.PromClient.GetRawData("center_disk_usage", tracker.AdapterOption{AdapterId: centerIndex.Id}) + diskRawData, err := l.svcCtx.PromClient.GetRawData("center_disk_utilisation", tracker.AdapterOption{AdapterId: centerIndex.Id}) if err != nil { return nil, err } diff --git a/api/internal/logic/core/clustersloadlogic.go b/api/internal/logic/core/clustersloadlogic.go new file mode 100644 index 00000000..bf23008a --- /dev/null +++ b/api/internal/logic/core/clustersloadlogic.go @@ -0,0 +1,50 @@ +package core + +import ( + "context" + "github.com/zeromicro/go-zero/core/logx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/tracker" + "time" +) + +type ClustersLoadLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewClustersLoadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClustersLoadLogic { + return &ClustersLoadLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ClustersLoadLogic) ClustersLoad(req *types.ClustersLoadReq) (resp *types.ClustersLoadResp, err error) { + //resp = &types.ClustersLoadResp{} + //var server string + //metrics := []string{"cluster_cpu_total", "cluster_cpu_utilisation", "cluster_memory_avail", "cluster_memory_total", "cluster_disk_avail", "cluster_disk_total"} + //var remoteResp types.RemoteResp + //l.svcCtx.DbEngin.Raw("select server from t_adapter where id = ?", req.AdapterId).Scan(&server) + //adapterResp, err := l.svcCtx.HttpClient.R(). + // SetQueryParamsFromValues(map[string][]string{ + // "clusterName": []string{req.ClusterName}, + // "metrics": metrics, + // }). + // SetResult(&remoteResp). + // ForceContentType("application/json"). + // Get(server + "/api/v1/monitoring/cluster/load") + ////Get("http://47.92.39.128:31031/pcm/v1/adapter/cluster/list") + //if err != nil || adapterResp.IsError() { + // return nil, err + //} + //resp.Data = remoteResp.Data + resp = &types.ClustersLoadResp{} + metrics := []string{"cluster_cpu_utilisation", "cluster_cpu_avail", "cluster_cpu_total", "cluster_memory_total", "cluster_memory_avail", "cluster_memory_utilisation", "cluster_memory_utilisation", "cluster_memory_avail", "cluster_memory_total"} + result := l.svcCtx.PromClient.GetNamedMetrics(metrics, time.Now(), tracker.ClusterOption{}) + println(len(result)) + return resp, nil +} diff --git a/api/internal/logic/core/commitvmtasktemplogic.go b/api/internal/logic/core/commitvmtasktemplogic.go new file mode 100644 index 00000000..f9501d46 --- /dev/null +++ b/api/internal/logic/core/commitvmtasktemplogic.go @@ -0,0 +1,30 @@ +package core + +import ( + "context" + + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CommitVmTaskTempLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCommitVmTaskTempLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommitVmTaskTempLogic { + return &CommitVmTaskTempLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CommitVmTaskTempLogic) CommitVmTaskTemp(req *types.CommitVmTaskReq) (resp *types.CommitVmTaskResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/api/internal/logic/core/listdomainresourcelogic.go b/api/internal/logic/core/listdomainresourcelogic.go deleted file mode 100644 index cc4fe7bd..00000000 --- a/api/internal/logic/core/listdomainresourcelogic.go +++ /dev/null @@ -1,261 +0,0 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - -package core - -import ( - "context" - "fmt" - "github.com/shopspring/decimal" - "github.com/zeromicro/go-zero/core/logx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils/httputils" - "k8s.io/apimachinery/pkg/util/json" - "math" - "strconv" -) - -type ListDomainResourceLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -func NewListDomainResourceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListDomainResourceLogic { - return &ListDomainResourceLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *ListDomainResourceLogic) ListDomainResource() (resp *types.DomainResourceResp, err error) { - //TODO 域信息查询数算集群监控 - resp = &types.DomainResourceResp{} - var domainResourceModel []models.DomainResource - sqlStr := "select * from `joint_domain`.domain_cluster" - l.svcCtx.DbEngin.Raw(sqlStr).Scan(&domainResourceModel) - utils.Convert(domainResourceModel, &resp.DomainResourceList) - metrics := &types.ClusterMetrics{} - //获取指定集群监控数据 - for i := 0; i < len(resp.DomainResourceList); i++ { - url := fmt.Sprintf("%s/api/v1/resource/getClusterMetrics?clusterName=%s", l.svcCtx.Config.JccScheduleUrl, resp.DomainResourceList[i].ClusterName) - bytes, err := httputils.HttpGet("GET", url) - if err != nil { - logx.WithContext(l.ctx).Errorf("获取云算指定集群监控数据 err: %s", err.Error()) - return nil, err - } - json.Unmarshal(bytes, metrics) - if metrics.Code == 200 { - //fmt.Print(metrics) - for _, metricResult := range metrics.Data { - //集群内存已使用 - if metricResult.MetricName == "cluster_memory_usage_wo_cache" { - format, ok := metricResult.MetricData.Result[0]["values"].([]interface{}) - if ok { - for _, val := range format { - f, ok := val.([]interface{}) - if ok { - value, _ := f[1].(string) - v1, err := strconv.ParseFloat(value, 32) - if err != nil { - continue - } - v2, _ := decimal.NewFromFloat(v1 / (1024 * 1024 * 1024)).Round(2).Float64() - resp.DomainResourceList[i].MemoryUsage = v2 - } else { - continue - } - } - } else { - continue - } - } - //集群内存总量 - if metricResult.MetricName == "cluster_memory_total" { - format, ok := metricResult.MetricData.Result[0]["values"].([]interface{}) - if ok { - for _, val := range format { - f, ok := val.([]interface{}) - if ok { - value, _ := f[1].(string) - v1, err := strconv.ParseFloat(value, 32) - if err != nil { - continue - } - v2, _ := decimal.NewFromFloat(v1 / (1024 * 1024 * 1024)).Round(2).Float64() - resp.DomainResourceList[i].MemoryTotal = v2 - } else { - continue - } - } - } else { - continue - } - } - //集群cpu已使用 - if metricResult.MetricName == "cluster_cpu_usage" { - format, ok := metricResult.MetricData.Result[0]["values"].([]interface{}) - if ok { - for _, val := range format { - f, ok := val.([]interface{}) - if ok { - value, _ := f[1].(string) - v1, err := strconv.ParseFloat(value, 32) - if err != nil { - continue - } - v2, _ := decimal.NewFromFloat(v1).Round(2).Float64() - resp.DomainResourceList[i].CpuUsage = v2 - } else { - continue - } - } - } else { - continue - } - } - //集群cpu总核数 - if metricResult.MetricName == "cluster_cpu_total" { - format, ok := metricResult.MetricData.Result[0]["values"].([]interface{}) - if ok { - for _, val := range format { - f, ok := val.([]interface{}) - if ok { - value, _ := f[1].(string) - v1, err := strconv.ParseFloat(value, 32) - if err != nil { - continue - } - v2, _ := decimal.NewFromFloat(v1).Round(2).Float64() - resp.DomainResourceList[i].CpuTotal = v2 - } else { - continue - } - } - } else { - continue - } - } - //集群容器节点已使用数量 - if metricResult.MetricName == "cluster_pod_running_count" { - format, ok := metricResult.MetricData.Result[0]["values"].([]interface{}) - if ok { - for _, val := range format { - f, ok := val.([]interface{}) - if ok { - value, _ := f[1].(string) - v1, err := strconv.ParseFloat(value, 32) - if err != nil { - continue - } - v2, _ := decimal.NewFromFloat(v1).Round(2).Float64() - resp.DomainResourceList[i].NodeUsage = v2 - } else { - continue - } - } - } else { - continue - } - } - //集群容器节点总量 - if metricResult.MetricName == "cluster_pod_quota" { - format, ok := metricResult.MetricData.Result[0]["values"].([]interface{}) - if ok { - for _, val := range format { - f, ok := val.([]interface{}) - if ok { - value, _ := f[1].(string) - v1, err := strconv.ParseFloat(value, 32) - if err != nil { - continue - } - v2, _ := decimal.NewFromFloat(v1).Round(2).Float64() - resp.DomainResourceList[i].NodeTotal = v2 - } else { - continue - } - } - } else { - continue - } - } - //集群磁盘已使用 - if metricResult.MetricName == "cluster_disk_size_usage" { - format, ok := metricResult.MetricData.Result[0]["values"].([]interface{}) - if ok { - for _, val := range format { - f, ok := val.([]interface{}) - if ok { - value, _ := f[1].(string) - v1, err := strconv.ParseFloat(value, 32) - if err != nil { - continue - } - v2, _ := decimal.NewFromFloat(v1 / (1000 * 1000 * 1000)).Round(2).Float64() - resp.DomainResourceList[i].DiskUsage = v2 - } else { - continue - } - } - } else { - continue - } - } - //集群磁盘总量 - if metricResult.MetricName == "cluster_disk_size_capacity" { - format, ok := metricResult.MetricData.Result[0]["values"].([]interface{}) - if ok { - for _, val := range format { - f, ok := val.([]interface{}) - if ok { - value, _ := f[1].(string) - v1, err := strconv.ParseFloat(value, 32) - if err != nil { - continue - } - v2, _ := decimal.NewFromFloat(v1 / (1000 * 1000 * 1000)).Round(2).Float64() - resp.DomainResourceList[i].DiskTotal = v2 - } else { - continue - } - } - } else { - continue - } - } - if resp.DomainResourceList[i].CpuUsage != 0 && resp.DomainResourceList[i].CpuTotal != 0 { - resp.DomainResourceList[i].Cpu = math.Ceil((resp.DomainResourceList[i].CpuUsage / resp.DomainResourceList[i].CpuTotal) * 10000 / 100.00) - } - if resp.DomainResourceList[i].NodeUsage != 0 && resp.DomainResourceList[i].NodeTotal != 0 { - resp.DomainResourceList[i].NodeCount = math.Ceil((resp.DomainResourceList[i].NodeUsage / resp.DomainResourceList[i].NodeTotal) * 10000 / 100.00) - } - if resp.DomainResourceList[i].DiskUsage != 0 && resp.DomainResourceList[i].DiskTotal != 0 { - resp.DomainResourceList[i].Disk = math.Ceil((resp.DomainResourceList[i].DiskUsage / resp.DomainResourceList[i].DiskTotal) * 10000 / 100.00) - } - if resp.DomainResourceList[i].MemoryUsage != 0 && resp.DomainResourceList[i].MemoryTotal != 0 { - resp.DomainResourceList[i].Memory = math.Ceil((resp.DomainResourceList[i].MemoryUsage / resp.DomainResourceList[i].MemoryTotal) * 10000 / 100.00) - } - resp.DomainResourceList[i].DomainName = resp.DomainResourceList[i].Description - resp.DomainResourceList[i].ResourceType = "云算" - resp.DomainResourceList[i].Stack = "kubernetes" - } - } - } - return resp, nil -} diff --git a/api/internal/logic/core/syncclusterloadlogic.go b/api/internal/logic/core/syncclusterloadlogic.go index 75f10c5e..f605521d 100644 --- a/api/internal/logic/core/syncclusterloadlogic.go +++ b/api/internal/logic/core/syncclusterloadlogic.go @@ -27,15 +27,15 @@ func NewSyncClusterLoadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *S func (l *SyncClusterLoadLogic) SyncClusterLoad(req *types.SyncClusterLoadReq) error { if len(req.ClusterLoadRecords) != 0 { for _, record := range req.ClusterLoadRecords { - tracker.ClusterCpuUsageGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.CpuUsage) + tracker.ClusterCpuUtilisationGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.CpuUtilisation) tracker.ClusterCpuAvailGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.CpuAvail) tracker.ClusterCpuTotalGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.CpuTotal) - tracker.ClusterMemoryUsageGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.MemoryUsage) + tracker.ClusterMemoryUtilisationGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.MemoryUtilisation) tracker.ClusterMemoryAvailGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.MemoryAvail) tracker.ClusterMemoryTotalGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.MemoryTotal) - tracker.ClusterDiskUsageGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.DiskUsage) + tracker.ClusterDiskUtilisationGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.DiskUtilisation) tracker.ClusterDiskAvailGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.DiskAvail) tracker.ClusterDiskTotalGauge.WithLabelValues(record.ClusterName, strconv.FormatInt(record.AdapterId, 10)).Set(record.DiskTotal) } diff --git a/api/internal/scheduler/service/collector/collector.go b/api/internal/scheduler/service/collector/collector.go index b4d66c68..8d67175c 100644 --- a/api/internal/scheduler/service/collector/collector.go +++ b/api/internal/scheduler/service/collector/collector.go @@ -3,6 +3,7 @@ package collector type AiCollector interface { GetResourceStats() (*ResourceStats, error) GetDatasetsSpecs() ([]*DatasetsSpecs, error) + GetAlgorithms() ([]*Algorithm, error) } type ResourceStats struct { @@ -33,3 +34,9 @@ type DatasetsSpecs struct { Name string Size string } + +type Algorithm struct { + Name string + Platform string + TaskType string +} diff --git a/api/internal/storeLink/modelarts.go b/api/internal/storeLink/modelarts.go index b9bf8abe..64c3437b 100644 --- a/api/internal/storeLink/modelarts.go +++ b/api/internal/storeLink/modelarts.go @@ -157,6 +157,10 @@ func (m *ModelArtsLink) GetDatasetsSpecs() ([]*collector.DatasetsSpecs, error) { return nil, nil } +func (m *ModelArtsLink) GetAlgorithms() ([]*collector.Algorithm, error) { + return nil, nil +} + func (m *ModelArtsLink) Execute(option *option.AiOption) (interface{}, error) { err := m.GenerateSubmitParams(option) if err != nil { diff --git a/api/internal/storeLink/octopus.go b/api/internal/storeLink/octopus.go index 5342d8ce..b3bd546a 100644 --- a/api/internal/storeLink/octopus.go +++ b/api/internal/storeLink/octopus.go @@ -315,6 +315,29 @@ func (o *OctopusLink) GetDatasetsSpecs() ([]*collector.DatasetsSpecs, error) { return specs, nil } +func (o *OctopusLink) GetAlgorithms() ([]*collector.Algorithm, error) { + var algorithms []*collector.Algorithm + + req := &octopus.GetMyAlgorithmListReq{ + Platform: o.platform, + PageIndex: o.pageIndex, + PageSize: o.pageSize, + } + resp, err := o.svcCtx.OctopusRpc.GetMyAlgorithmList(o.ctx, req) + if err != nil { + return nil, err + } + if !resp.Success { + return nil, errors.New("failed to get algorithms") + } + + for _, a := range resp.Payload.Algorithms { + algorithm := &collector.Algorithm{Name: a.AlgorithmName, Platform: OCTOPUS, TaskType: strings.ToLower(a.FrameworkName)} + algorithms = append(algorithms, algorithm) + } + return algorithms, nil +} + func (o *OctopusLink) Execute(option *option.AiOption) (interface{}, error) { err := o.GenerateSubmitParams(option) if err != nil { diff --git a/api/internal/storeLink/shuguangai.go b/api/internal/storeLink/shuguangai.go index f44466fe..654e12b4 100644 --- a/api/internal/storeLink/shuguangai.go +++ b/api/internal/storeLink/shuguangai.go @@ -267,12 +267,15 @@ func (s *ShuguangAi) QuerySpecs() (interface{}, error) { } func (s *ShuguangAi) GetResourceStats() (*collector.ResourceStats, error) { + //balance userReq := &hpcAC.GetUserInfoReq{} userinfo, err := s.svcCtx.ACRpc.GetUserInfo(s.ctx, userReq) if err != nil { return nil, err } + balance, _ := strconv.ParseFloat(userinfo.Data.AccountBalance, 64) + //resource limit limitReq := &hpcAC.QueueReq{} limitResp, err := s.svcCtx.ACRpc.QueryUserQuotasLimit(s.ctx, limitReq) if err != nil { @@ -281,20 +284,54 @@ func (s *ShuguangAi) GetResourceStats() (*collector.ResourceStats, error) { totalCpu := limitResp.Data.AccountMaxCpu totalDcu := limitResp.Data.AccountMaxDcu + //disk diskReq := &hpcAC.ParaStorQuotaReq{} diskResp, err := s.svcCtx.ACRpc.ParaStorQuota(s.ctx, diskReq) if err != nil { return nil, err } - totalDisk := common.RoundFloat(diskResp.Data[0].Threshold*KB*KB, 3) - availDisk := common.RoundFloat((diskResp.Data[0].Threshold-diskResp.Data[0].Usage)*KB*KB, 3) + totalDisk := common.RoundFloat(diskResp.Data[0].Threshold*KB*KB*KB, 3) + availDisk := common.RoundFloat((diskResp.Data[0].Threshold-diskResp.Data[0].Usage)*KB*KB*KB, 3) - generalInfo, err := s.svcCtx.ACRpc.GetGeneralInfo(s.ctx, nil) - memSize := common.RoundFloat(float64(generalInfo.MemoryInGib)*KB*KB, 3) + //memory + nodeResp, err := s.svcCtx.ACRpc.GetNodeResources(s.ctx, nil) + if err != nil { + return nil, err + } + memSize := common.RoundFloat(float64(nodeResp.Data.MemorySize)*KB*KB, 3) // MB to BYTES + //resources being occupied + memberJobResp, err := s.svcCtx.ACRpc.GetMemberJobs(s.ctx, nil) + if err != nil { + return nil, err + } + var CpuCoreAvail int64 + var MemAvail float64 + if len(memberJobResp.Data) != 0 { + CpuCoreAvail = totalCpu + MemAvail = memSize + } else { + var cpuCoreUsed int64 + var memUsed float64 + for _, datum := range memberJobResp.Data { + cpuCoreUsed += datum.CpuCore + } + memUsed = float64(cpuCoreUsed * 2 * KB * KB * KB) // 2 GB per cpu core + if cpuCoreUsed > totalCpu { + CpuCoreAvail = 0 + } else { + CpuCoreAvail = totalCpu - cpuCoreUsed + } + if memUsed > memSize { + MemAvail = 0 + } else { + MemAvail = memSize - memUsed + } + } + + //usable hours var cards []*collector.Card - balance, _ := strconv.ParseFloat(userinfo.Data.AccountBalance, 64) cardHours := common.RoundFloat(balance/DCUPRICEPERHOUR, 3) cpuHours := common.RoundFloat(balance/CPUCOREPRICEPERHOUR, 3) @@ -312,11 +349,11 @@ func (s *ShuguangAi) GetResourceStats() (*collector.ResourceStats, error) { Name: s.platform, Balance: balance, CpuCoreTotal: totalCpu, - CpuCoreAvail: 0, + CpuCoreAvail: CpuCoreAvail, DiskTotal: totalDisk, DiskAvail: availDisk, MemTotal: memSize, - MemAvail: 0, + MemAvail: MemAvail, CpuCoreHours: cpuHours, CardsAvail: cards, } @@ -341,6 +378,26 @@ func (s *ShuguangAi) GetDatasetsSpecs() ([]*collector.DatasetsSpecs, error) { return specs, nil } +func (s *ShuguangAi) GetAlgorithms() ([]*collector.Algorithm, error) { + var algorithms []*collector.Algorithm + for _, t := range GetTaskTypes() { + taskType := t + req := &hpcAC.GetFileListReq{Limit: 100, Path: ALGORITHM_DIR + FORWARD_SLASH + taskType, Start: 0} + list, err := s.svcCtx.ACRpc.GetFileList(s.ctx, req) + if err != nil { + return nil, err + } + if list.Code != "0" { + return nil, errors.New(list.Msg) + } + for _, file := range list.Data.FileList { + algorithm := &collector.Algorithm{Name: file.Name, Platform: SHUGUANGAI, TaskType: taskType} + algorithms = append(algorithms, algorithm) + } + } + return algorithms, nil +} + func (s *ShuguangAi) Execute(option *option.AiOption) (interface{}, error) { err := s.GenerateSubmitParams(option) if err != nil { diff --git a/api/internal/storeLink/storeLink.go b/api/internal/storeLink/storeLink.go index c77d3df2..e54c722c 100644 --- a/api/internal/storeLink/storeLink.go +++ b/api/internal/storeLink/storeLink.go @@ -27,6 +27,7 @@ import ( "gitlink.org.cn/jcce-pcm/pcm-participant-modelarts/modelarts" "gitlink.org.cn/jcce-pcm/pcm-participant-octopus/octopus" "gorm.io/gorm" + "strings" ) type Linkage interface { @@ -152,6 +153,48 @@ func GetDatasetsNames(collectorMap *map[string]collector.AiCollector) ([]string, return names, nil } +func GetAlgorithms(collectorMap *map[string]collector.AiCollector, resourceType string, taskType string, dataset string) ([]string, error) { + var names []string + colMap := *collectorMap + for _, col := range colMap { + var ns []string + algorithms, err := col.GetAlgorithms() + if err != nil { + return nil, err + } + for _, algorithm := range algorithms { + if algorithm.TaskType != taskType { + continue + } + switch algorithm.Platform { + case OCTOPUS: + splitns := strings.Split(algorithm.Name, UNDERSCORE) + if dataset != splitns[0] || len(splitns) == 1 { + continue + } + ns = append(ns, splitns[1]) + case SHUGUANGAI: + splitns := strings.Split(algorithm.Name, DASH) + if dataset != splitns[0] || len(splitns) == 1 { + continue + } + ns = append(ns, splitns[1]) + } + } + if len(ns) == 0 { + continue + } + if len(names) == 0 { + names = ns + continue + } + + names = common.IntersectString(names, ns) + } + names = common.RemoveDuplicates(names) + return names, nil +} + func GetTaskTypes() []string { return taskTypes } diff --git a/api/internal/svc/servicecontext.go b/api/internal/svc/servicecontext.go index e96cf601..27cdf8ca 100644 --- a/api/internal/svc/servicecontext.go +++ b/api/internal/svc/servicecontext.go @@ -21,6 +21,8 @@ import ( "github.com/aws/aws-sdk-go/service/s3/s3manager" "github.com/docker/docker/client" "github.com/go-redis/redis/v8" + "github.com/go-resty/resty/v2" + alert "github.com/prometheus/alertmanager/api/v2/client" "github.com/robfig/cron/v3" "github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/zrpc" @@ -62,6 +64,8 @@ type ServiceContext struct { MonitorClient map[int64]tracker.Prometheus ParticipantRpc participantservice.ParticipantService PromClient tracker.Prometheus + AlertClient *alert.AlertmanagerAPI + HttpClient *resty.Client } func NewServiceContext(c config.Config) *ServiceContext { @@ -73,7 +77,14 @@ func NewServiceContext(c config.Config) *ServiceContext { DisableSSL: aws.Bool(false), //是否禁用https,这里表示不禁用,即使用HTTPS S3ForcePathStyle: aws.Bool(true), //使用路径样式而非虚拟主机样式,区别请参考:https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html }) - promClient, err := tracker.NewPrometheus(c.PromUrl) + promClient, err := tracker.NewPrometheus(c.Monitoring.PromUrl) + + if err != nil { + logx.Errorf("InitPrometheus err: %v", err) + panic("InitSnowflake err") + } + httpClient := resty.New() + alertClient := tracker.NewAlertClient(c.Monitoring.AlertUrl) if err != nil { logx.Errorf("InitPrometheus err: %v", err) panic("InitSnowflake err") @@ -135,5 +146,7 @@ func NewServiceContext(c config.Config) *ServiceContext { Downloader: downloader, Uploader: uploader, PromClient: promClient, + AlertClient: alertClient, + HttpClient: httpClient, } } diff --git a/api/internal/types/types.go b/api/internal/types/types.go index 52af5b0d..fa7709f8 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -25,22 +25,37 @@ type CenterIndex struct { CenterType string `json:"centerType"` } +type RemoteResp struct { + Code int `json:"code"` + Message string `json:"message"` + Data interface{} `json:"data"` +} + +type ClustersLoadReq struct { + AdapterId int64 `form:"adapterId"` + ClusterName string `form:"clusterName"` +} + +type ClustersLoadResp struct { + Data interface{} `json:"data"` +} + type SyncClusterLoadReq struct { ClusterLoadRecords []ClusterLoadRecord `json:"clusterLoadRecords"` } type ClusterLoadRecord struct { - AdapterId int64 `json:"adapterId"` - ClusterName string `json:"clusterName"` - CpuAvail float64 `json:"cpuAvail"` - CpuTotal float64 `json:"cpuTotal"` - CpuUsage float64 `json:"cpuUsage"` - MemoryAvail float64 `json:"memoryAvail"` - MemoryUsage float64 `json:"memoryUsage"` - MemoryTotal float64 `json:"memoryTotal"` - DiskAvail float64 `json:"diskAvail"` - DiskTotal float64 `json:"diskTotal"` - DiskUsage float64 `json:"diskUsage"` + AdapterId int64 `json:"adapterId"` + ClusterName string `json:"clusterName"` + CpuAvail float64 `json:"cpuAvail"` + CpuTotal float64 `json:"cpuTotal"` + CpuUtilisation float64 `json:"cpuUtilisation"` + MemoryAvail float64 `json:"memoryAvail"` + MemoryUtilisation float64 `json:"memoryUtilisation"` + MemoryTotal float64 `json:"memoryTotal"` + DiskAvail float64 `json:"diskAvail"` + DiskTotal float64 `json:"diskTotal"` + DiskUtilisation float64 `json:"diskUtilisation"` } type GetClusterListReq struct { @@ -397,27 +412,6 @@ type ComputilityStatistics struct { ClusterNum int64 `json:"clusterNum"` //集群总数 } -type ClusterMetrics struct { - Code int `json:"code,omitempty"` - Msg string `json:"msg,omitempty"` - Data []MetricResult `json:"data,omitempty"` -} - -type MetricResult struct { - MetricName string `json:"metric_name, omitempty"` - MetricData MetricData `json:"data, omitempty"` -} - -type MetricData struct { - Result []map[string]interface{} `json:"result"` - ResultType string `json:"resultType"` -} - -type ResultData struct { - Status string `json:"status"` - Data MetricData `json:"data"` -} - type NodeAssetsResp struct { NodeAssets []NodeAsset `json:"nodeAssets"` } @@ -2907,7 +2901,7 @@ type DeleteServerResp struct { type CreateServerReq struct { Server Server `json:"server" copier:"Server"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } type CreateServerResp struct { @@ -3324,7 +3318,7 @@ type DeleteNetworkResp struct { type CreateNetworkReq struct { Network CreateNetwork `json:"network" copier:"Network"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } type CreateNetworkResp struct { @@ -3342,7 +3336,7 @@ type CreateNetwork struct { type CreateSubnetReq struct { Subnet Subnet `json:"subnet" copier:"Subnet"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } type CreateSubnetResp struct { diff --git a/go.mod b/go.mod index 13dde252..20445f33 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/JCCE-nudt/zero-contrib/zrpc/registry/nacos v0.0.0-20230419021610-13bbc83fbc3c github.com/Masterminds/squirrel v1.5.4 github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800 - github.com/aws/aws-sdk-go v1.47.5 + github.com/aws/aws-sdk-go v1.50.8 github.com/bwmarrin/snowflake v0.3.0 github.com/docker/docker v24.0.7+incompatible github.com/ghodss/yaml v1.0.0 @@ -17,11 +17,11 @@ require ( github.com/json-iterator/go v1.1.12 github.com/nacos-group/nacos-sdk-go/v2 v2.2.4 github.com/pkg/errors v0.9.1 + github.com/prometheus/alertmanager v0.27.0 github.com/prometheus/client_golang v1.19.0 github.com/prometheus/common v0.50.0 github.com/robfig/cron/v3 v3.0.1 github.com/rs/zerolog v1.28.0 - github.com/shopspring/decimal v1.3.1 github.com/zeromicro/go-zero v1.6.3 gitlink.org.cn/JointCloud/pcm-kubernetes v0.0.0-20240301071143-347480abff2c gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240307072630-6ff50727536a @@ -45,11 +45,16 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/alecthomas/kingpin/v2 v2.4.0 // indirect + github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect github.com/alibabacloud-go/tea v1.1.17 // indirect github.com/alibabacloud-go/tea-utils v1.4.4 // indirect github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 // indirect github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 // indirect + github.com/armon/go-metrics v0.3.10 // indirect + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect + github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect @@ -63,43 +68,78 @@ require ( github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.11.3 // indirect github.com/fatih/color v1.16.0 // indirect + github.com/go-kit/log v0.2.1 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/analysis v0.22.2 // indirect + github.com/go-openapi/errors v0.21.0 // indirect github.com/go-openapi/jsonpointer v0.20.3 // indirect github.com/go-openapi/jsonreference v0.20.5 // indirect + github.com/go-openapi/loads v0.21.5 // indirect + github.com/go-openapi/runtime v0.27.1 // indirect + github.com/go-openapi/spec v0.20.14 // indirect + github.com/go-openapi/strfmt v0.22.0 // indirect github.com/go-openapi/swag v0.22.10 // indirect + github.com/go-openapi/validate v0.23.0 // indirect + github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect + github.com/google/btree v1.0.1 // indirect github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-msgpack v0.5.3 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-sockaddr v1.0.6 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/hashicorp/memberlist v0.5.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect + github.com/jpillora/backoff v1.0.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/miekg/dns v1.1.41 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect + github.com/oklog/run v1.1.0 // indirect + github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/prometheus/client_model v0.6.0 // indirect + github.com/prometheus/common/sigv4 v0.1.0 // indirect + github.com/prometheus/exporter-toolkit v0.11.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/redis/go-redis/v9 v9.5.1 // indirect + github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect + github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect + github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/xhit/go-str2duration/v2 v2.1.0 // indirect + github.com/xlab/treeprint v1.2.0 // indirect go.etcd.io/etcd/api/v3 v3.5.12 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect go.etcd.io/etcd/client/v3 v3.5.12 // indirect + go.mongodb.org/mongo-driver v1.13.1 // indirect go.opentelemetry.io/otel v1.24.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect diff --git a/go.sum b/go.sum index ebd640ab..cf7c30bb 100644 --- a/go.sum +++ b/go.sum @@ -393,6 +393,7 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/JCCE-nudt/zero-contrib/zrpc/registry/nacos v0.0.0-20230419021610-13bbc83fbc3c h1:qoPu5FeE6dsvZ7AmH/l3Y5RxrJPNVKvsQSrjQpWUCMQ= github.com/JCCE-nudt/zero-contrib/zrpc/registry/nacos v0.0.0-20230419021610-13bbc83fbc3c/go.mod h1:GuCS4be9IH3bSBTvbzz34nszPQDO33PIOv5nviEaFMw= github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM= @@ -405,11 +406,15 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.37.2/go.mod h1:Nxye/E+YPru//Bpaorfhc3JsSGYwCaDDj+R4bK52U5o= github.com/Shopify/toxiproxy/v2 v2.5.0/go.mod h1:yhM2epWtAmel9CB8r2+L+PCmhH6yH2pITaPAo7jxJl0= +github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= +github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50= github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY= github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg= @@ -431,11 +436,19 @@ github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2/go.mod h1:GDtq+Kw+v0fO+j5B github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 h1:olLiPI2iM8Hqq6vKnSxpM3awCrm9/BeOgHpzQkOYnI4= github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7/go.mod h1:oDg1j4kFxnhgftaiLJABkGeSvuEvSF5Lo6UmRAMruX4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.47.5 h1:U2JlfPmrUoz5p+2X/XwKxmaJFo2oV+LbJqx8jyEvyAY= -github.com/aws/aws-sdk-go v1.47.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.50.8 h1:gY0WoOW+/Wz6XmYSgDH9ge3wnAevYDSQWPxxJvqAkP4= +github.com/aws/aws-sdk-go v1.50.8/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= +github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -463,6 +476,8 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -542,9 +557,12 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= @@ -555,6 +573,10 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/analysis v0.22.2 h1:ZBmNoP2h5omLKr/srIC9bfqrUGzT6g6gNv03HE9Vpj0= +github.com/go-openapi/analysis v0.22.2/go.mod h1:pDF4UbZsQTo/oNuRfAWWd4dAh4yuYf//LYorPTjrpvo= +github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= +github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.20.3 h1:jykzYWS/kyGtsHfRt6aV8JTB9pcQAXPIA7qlZ5aRlyk= @@ -563,10 +585,20 @@ github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL9 github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/jsonreference v0.20.5 h1:hutI+cQI+HbSQaIGSfsBsYI0pHk+CATf8Fk5gCSj0yI= github.com/go-openapi/jsonreference v0.20.5/go.mod h1:thAqAp31UABtI+FQGKAQfmv7DbFpKNUlva2UPCxKu2Y= +github.com/go-openapi/loads v0.21.5 h1:jDzF4dSoHw6ZFADCGltDb2lE4F6De7aWSpe+IcsRzT0= +github.com/go-openapi/loads v0.21.5/go.mod h1:PxTsnFBoBe+z89riT+wYt3prmSBP6GDAQh2l9H1Flz8= +github.com/go-openapi/runtime v0.27.1 h1:ae53yaOoh+fx/X5Eaq8cRmavHgDma65XPZuvBqvJYto= +github.com/go-openapi/runtime v0.27.1/go.mod h1:fijeJEiEclyS8BRurYE1DE5TLb9/KZl6eAdbzjsrlLU= +github.com/go-openapi/spec v0.20.14 h1:7CBlRnw+mtjFGlPDRZmAMnq35cRzI91xj03HVyUi/Do= +github.com/go-openapi/spec v0.20.14/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw= +github.com/go-openapi/strfmt v0.22.0 h1:Ew9PnEYc246TwrEspvBdDHS4BVKXy/AOVsfqGDgAcaI= +github.com/go-openapi/strfmt v0.22.0/go.mod h1:HzJ9kokGIju3/K6ap8jL+OlGAbjpSv27135Yr9OivU4= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.22.10 h1:4y86NVn7Z2yYd6pfS4Z+Nyh3aAUL3Nul+LMbhFKy0gA= github.com/go-openapi/swag v0.22.10/go.mod h1:Cnn8BYtRlx6BNE3DPN86f/xkapGIcLWzh3CLEb4C1jI= +github.com/go-openapi/validate v0.23.0 h1:2l7PJLzCis4YUGEoW6eoQw3WhyM65WSIcjX6SQnlfDw= +github.com/go-openapi/validate v0.23.0/go.mod h1:EeiAZ5bmpSIOJV1WLfyYF9qp/B1ZgSaEpHTJHtN5cbE= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-resty/resty/v2 v2.11.0 h1:i7jMfNOJYMp69lq7qozJP+bjgzfAzeOhuGlyDrqxT/8= @@ -579,6 +611,8 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78 github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= +github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -630,6 +664,7 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 h1:0VpGH+cDhbDtdcweoyCVsF3fhN8kejK6rFe/2FFX2nU= @@ -712,12 +747,33 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHg github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-sockaddr v1.0.6 h1:RSG8rKU28VTUTvEKghe5gIhIQpv8evvNpnDEyqO4u9I= +github.com/hashicorp/go-sockaddr v1.0.6/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= +github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -763,6 +819,7 @@ github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2E github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -815,9 +872,16 @@ github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOj github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= @@ -846,6 +910,10 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -876,9 +944,14 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= @@ -896,8 +969,11 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= +github.com/prometheus/alertmanager v0.27.0 h1:V6nTa2J5V4s8TG4C4HtrBP/WNSebCCTYGGv4qecA/+I= +github.com/prometheus/alertmanager v0.27.0/go.mod h1:8Ia/R3urPmbzJ8OsdvmZvIprDwvwmYCmUbwBL+jlPOE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= @@ -915,14 +991,21 @@ github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3d github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= +github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= +github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= +github.com/prometheus/exporter-toolkit v0.11.0 h1:yNTsuZ0aNCNFQ3aFTD2uhPOvr4iD7fdBvKPAEGkNf+g= +github.com/prometheus/exporter-toolkit v0.11.0/go.mod h1:BVnENhnNecpwoTLiABx7mrPB/OLRIgN74qlQbV+FK1Q= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= @@ -946,8 +1029,12 @@ github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -980,10 +1067,17 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/urfave/cli/v2 v2.11.0/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= +github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= +github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= +github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1022,6 +1116,8 @@ go.etcd.io/etcd/client/v3 v3.5.7/go.mod h1:sOWmj9DZUMyAngS7QQwCyAXXAL6WhgTOPLNS/ go.etcd.io/etcd/client/v3 v3.5.12 h1:v5lCPXn1pf1Uu3M4laUE2hp/geOTc5uPcYYsNe1lDxg= go.etcd.io/etcd/client/v3 v3.5.12/go.mod h1:tSbBCakoWmmddL+BKVAJHa9km+O/E+bumDe9mSbPiqw= go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= +go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= +go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -1066,6 +1162,8 @@ go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxi go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= @@ -1088,6 +1186,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1163,6 +1262,7 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1282,6 +1382,8 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1313,6 +1415,7 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1423,6 +1526,7 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= diff --git a/pkg/tracker/promql.go b/pkg/tracker/promql.go index d9403d7c..bf2ad8f4 100644 --- a/pkg/tracker/promql.go +++ b/pkg/tracker/promql.go @@ -27,12 +27,12 @@ const ( var promQLTemplates = map[string]string{ - "cluster_cpu_usage": "sum by (cluster_name)(cluster_cpu_usage{$1})", - "cluster_memory_usage": "sum by (cluster_name)(cluster_memory_usage{$1})", - "cluster_disk_usage": "sum by (cluster_name)(cluster_disk_usage{$1})", - "center_cpu_usage": "(sum by (adapter_id)(cluster_cpu_total{$1})-sum by (adapter_id)(cluster_cpu_avail{$1}))/sum by (adapter_id)(cluster_cpu_total{$1})", - "center_memory_usage": "(sum by (adapter_id)(cluster_memory_total{$1})-sum by (adapter_id)(cluster_memory_avail{$1}))/sum by (adapter_id)(cluster_memory_total{$1})", - "center_disk_usage": "(sum by (adapter_id)(cluster_disk_total{$1})-sum by (adapter_id)(cluster_disk_avail{$1}))/sum by (adapter_id)(cluster_disk_total{$1})", + "cluster_cpu_utilisation": "sum by (cluster_name)(cluster_cpu_usage{$1})", + "cluster_memory_utilisation": "sum by (cluster_name)(cluster_memory_usage{$1})", + "cluster_disk_utilisation": "sum by (cluster_name)(cluster_disk_usage{$1})", + "center_cpu_utilisation": "(sum by (adapter_id)(cluster_cpu_total{$1})-sum by (adapter_id)(cluster_cpu_avail{$1}))/sum by (adapter_id)(cluster_cpu_total{$1})", + "center_memory_utilisation": "(sum by (adapter_id)(cluster_memory_total{$1})-sum by (adapter_id)(cluster_memory_avail{$1}))/sum by (adapter_id)(cluster_memory_total{$1})", + "center_disk_utilisation": "(sum by (adapter_id)(cluster_disk_total{$1})-sum by (adapter_id)(cluster_disk_avail{$1}))/sum by (adapter_id)(cluster_disk_total{$1})", "center_top3": "topk(3,((sum by (adapter_id)(cluster_cpu_total)-sum by (adapter_id)(cluster_cpu_avail))/sum by (adapter_id)(cluster_cpu_total) + (sum by (adapter_id)(cluster_memory_total) - sum by (adapter_id)(cluster_memory_avail))/sum by (adapter_id)(cluster_memory_total) + (sum by (adapter_id)(cluster_disk_total)-sum by (adapter_id)(cluster_disk_avail))/sum by (adapter_id)(cluster_disk_total))/3)", "namespace_cpu_usage": `round(namespace:container_cpu_usage_seconds_total:sum_rate{namespace!="", $1}, 0.001)`, "namespace_memory_usage": `namespace:container_memory_usage_bytes:sum{namespace!="", $1}`, diff --git a/pkg/tracker/queryoptions.go b/pkg/tracker/queryoptions.go index 72bba046..dfdf3831 100644 --- a/pkg/tracker/queryoptions.go +++ b/pkg/tracker/queryoptions.go @@ -101,6 +101,7 @@ func (a AdapterOption) Apply(o *QueryOptions) { } type ClusterOption struct { + AdapterId int ClusterName string } diff --git a/pkg/tracker/tracker.go b/pkg/tracker/tracker.go index 47b66a27..b9b0058e 100644 --- a/pkg/tracker/tracker.go +++ b/pkg/tracker/tracker.go @@ -16,10 +16,13 @@ package tracker import ( "context" + "github.com/prometheus/alertmanager/api/v2/client" + "github.com/prometheus/alertmanager/cli" "github.com/prometheus/client_golang/api" v1 "github.com/prometheus/client_golang/api/prometheus/v1" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" + "net/url" "strconv" "strings" "sync" @@ -27,9 +30,9 @@ import ( ) var ( - ClusterCpuUsageGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "cluster_cpu_usage", - Help: "Cluster CPU Utilization Rate.", + ClusterCpuUtilisationGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "cluster_cpu_utilisation", + Help: "Cluster CPU Utilisation Rate.", }, []string{"cluster_name", "adapter_id"}) ClusterCpuAvailGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "cluster_cpu_avail", @@ -39,9 +42,9 @@ var ( Name: "cluster_cpu_total", Help: "Cluster CPU Total.", }, []string{"cluster_name", "adapter_id"}) - ClusterMemoryUsageGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "cluster_memory_usage", - Help: "Cluster Memory Utilization Rate.", + ClusterMemoryUtilisationGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "cluster_memory_utilisation", + Help: "Cluster Memory Utilisation Rate.", }, []string{"cluster_name", "adapter_id"}) ClusterMemoryAvailGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "cluster_memory_avail", @@ -51,9 +54,9 @@ var ( Name: "cluster_memory_total", Help: "Cluster Memory Total.", }, []string{"cluster_name", "adapter_id"}) - ClusterDiskUsageGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "cluster_disk_usage", - Help: "Cluster Disk Utilization Rate.", + ClusterDiskUtilisationGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "cluster_disk_utilisation", + Help: "Cluster Disk Utilisation Rate.", }, []string{"cluster_name", "adapter_id"}) ClusterDiskAvailGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "cluster_disk_avail", @@ -65,13 +68,13 @@ var ( }, []string{"cluster_name", "adapter_id"}) metrics = []prometheus.Collector{ - ClusterCpuUsageGauge, + ClusterCpuUtilisationGauge, ClusterCpuAvailGauge, ClusterCpuTotalGauge, - ClusterMemoryUsageGauge, + ClusterMemoryUtilisationGauge, ClusterMemoryAvailGauge, ClusterMemoryTotalGauge, - ClusterDiskUsageGauge, + ClusterDiskUtilisationGauge, ClusterDiskAvailGauge, ClusterDiskTotalGauge, } @@ -92,8 +95,13 @@ func NewPrometheus(address string) (Prometheus, error) { Address: address, } - client, err := api.NewClient(cfg) - return Prometheus{client: v1.NewAPI(client)}, err + promClient, err := api.NewClient(cfg) + return Prometheus{client: v1.NewAPI(promClient)}, err +} + +func NewAlertClient(address string) *client.AlertmanagerAPI { + alertManagerClient := cli.NewAlertmanagerClient(&url.URL{Host: address}) + return alertManagerClient } func ParseTime(timestamp string) (time.Time, error) { @@ -130,6 +138,7 @@ func (p Prometheus) GetNamedMetricsByTime(metrics []string, start, end string, s End: endTimestamp, Step: step, } + p.client.Rules(context.Background()) value, _, err := p.client.QueryRange(context.Background(), makeExpr(metric, *opts), timeRange) if err != nil { parsedResp.Error = err.Error() @@ -266,3 +275,7 @@ func (p Prometheus) GetRawData(expr string, o QueryOption) (model.Value, error) } return value, nil } + +func AddAlertRule() { + +}