From 7d772ff1e45359552359bfa8d0b6f238c3c76e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Wed, 28 Sep 2022 15:26:29 +0800 Subject: [PATCH] fix(monitor): rename tags to tag_pairs (#15087) --- pkg/apis/compute/bucket.go | 1 + pkg/apis/compute/dbinstance.go | 1 + pkg/apis/compute/elasticcache.go | 1 + pkg/apis/compute/guests.go | 1 + pkg/apis/compute/host.go | 1 + pkg/apis/compute/kube_cluster.go | 1 + pkg/apis/compute/modelarts_pool.go | 1 + pkg/apis/compute/storage.go | 1 + pkg/apis/monitor/unifiedmonitor_const.go | 2 +- pkg/mcclient/options/monitor/simplequery.go | 2 +- 10 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/apis/compute/bucket.go b/pkg/apis/compute/bucket.go index a927a4bd9a..95ec281f1d 100644 --- a/pkg/apis/compute/bucket.go +++ b/pkg/apis/compute/bucket.go @@ -78,6 +78,7 @@ func (self BucketDetails) GetMetricTags() map[string]string { "status": self.Status, "tenant": self.Project, "tenant_id": self.ProjectId, + "external_id": self.ExternalId, } for k, v := range self.Metadata { if strings.HasPrefix(k, apis.USER_TAG_PREFIX) { diff --git a/pkg/apis/compute/dbinstance.go b/pkg/apis/compute/dbinstance.go index 11adaa5c80..b2123d244b 100644 --- a/pkg/apis/compute/dbinstance.go +++ b/pkg/apis/compute/dbinstance.go @@ -340,6 +340,7 @@ func (self DBInstanceDetails) GetMetricTags() map[string]string { "brand": self.Brand, "domain_id": self.DomainId, "project_domain": self.ProjectDomain, + "external_id": self.ExternalId, } if len(self.IpAddrs) > 0 { ret["rds_ip"] = strings.ReplaceAll(self.IpAddrs, ",", "|") diff --git a/pkg/apis/compute/elasticcache.go b/pkg/apis/compute/elasticcache.go index 60a6a2de05..8cb7682ab1 100644 --- a/pkg/apis/compute/elasticcache.go +++ b/pkg/apis/compute/elasticcache.go @@ -56,6 +56,7 @@ func (self ElasticcacheDetails) GetMetricTags() map[string]string { "brand": self.Brand, "domain_id": self.DomainId, "project_domain": self.ProjectDomain, + "external_id": self.ExternalId, } for k, v := range self.Metadata { if strings.HasPrefix(k, apis.USER_TAG_PREFIX) { diff --git a/pkg/apis/compute/guests.go b/pkg/apis/compute/guests.go index a07dea9f0f..067751f7fe 100644 --- a/pkg/apis/compute/guests.go +++ b/pkg/apis/compute/guests.go @@ -287,6 +287,7 @@ func (self ServerDetails) GetMetricTags() map[string]string { "project_domain": self.ProjectDomain, "account": self.Account, "account_id": self.AccountId, + "external_id": self.ExternalId, } for k, v := range self.Metadata { if strings.HasPrefix(k, apis.USER_TAG_PREFIX) { diff --git a/pkg/apis/compute/host.go b/pkg/apis/compute/host.go index c1cfba5510..b2bb3c5ca5 100644 --- a/pkg/apis/compute/host.go +++ b/pkg/apis/compute/host.go @@ -249,6 +249,7 @@ func (self HostDetails) GetMetricTags() map[string]string { "account": self.Account, "res_type": "host", "account_id": self.AccountId, + "external_id": self.ExternalId, } for k, v := range self.Metadata { if strings.HasPrefix(k, apis.USER_TAG_PREFIX) { diff --git a/pkg/apis/compute/kube_cluster.go b/pkg/apis/compute/kube_cluster.go index 2e0cac29be..2548d1d0cc 100644 --- a/pkg/apis/compute/kube_cluster.go +++ b/pkg/apis/compute/kube_cluster.go @@ -65,6 +65,7 @@ func (self KubeClusterDetails) GetMetricTags() map[string]string { "project_domain": self.ProjectDomain, "account": self.Account, "account_id": self.AccountId, + "external_id": self.ExternalId, } return ret } diff --git a/pkg/apis/compute/modelarts_pool.go b/pkg/apis/compute/modelarts_pool.go index ff5c6270b5..73924cbe97 100644 --- a/pkg/apis/compute/modelarts_pool.go +++ b/pkg/apis/compute/modelarts_pool.go @@ -63,6 +63,7 @@ func (self ModelartsPoolDetails) GetMetricTags() map[string]string { "domain_id": self.DomainId, "account_id": self.AccountId, "account": self.Account, + "external_id": self.ExternalId, } return ret } diff --git a/pkg/apis/compute/storage.go b/pkg/apis/compute/storage.go index afba0b98c5..c4dbb8657f 100644 --- a/pkg/apis/compute/storage.go +++ b/pkg/apis/compute/storage.go @@ -158,6 +158,7 @@ func (self StorageDetails) GetMetricTags() map[string]string { "brand": self.Brand, "domain_id": self.DomainId, "project_domain": self.ProjectDomain, + "external_id": self.ExternalId, } for k, v := range self.Metadata { if strings.HasPrefix(k, apis.USER_TAG_PREFIX) { diff --git a/pkg/apis/monitor/unifiedmonitor_const.go b/pkg/apis/monitor/unifiedmonitor_const.go index 5d241a3285..f529c269f4 100644 --- a/pkg/apis/monitor/unifiedmonitor_const.go +++ b/pkg/apis/monitor/unifiedmonitor_const.go @@ -99,7 +99,7 @@ type SimpleQueryInput struct { // 结束时间 EndTime time.Time `json:"end_time"` // 指定标签 - Tags map[string]string `json:"tags"` + Tags map[string]string `json:"tag_pairs"` } type SimpleQueryOutput struct { diff --git a/pkg/mcclient/options/monitor/simplequery.go b/pkg/mcclient/options/monitor/simplequery.go index ad93e14e81..2e4b10f404 100644 --- a/pkg/mcclient/options/monitor/simplequery.go +++ b/pkg/mcclient/options/monitor/simplequery.go @@ -46,7 +46,7 @@ func (o *SimpleQueryOptions) Params() (jsonutils.JSONObject, error) { } } if len(tags) > 0 { - ret.Set("tags", jsonutils.Marshal(tags)) + ret.Set("tag_pairs", jsonutils.Marshal(tags)) } return ret, nil }