Skip to content

Commit aab0248

Browse files
authored
Merge pull request #78 from zianazhao/master
fix: 1、lb-ipv6:负载均衡支持查询ipv6版实例 2、cdn-qcloud:修复cdn通用区数据
2 parents 750f43c + 2353fa5 commit aab0248

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

pkg/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ var (
7676
}
7777
)
7878

79+
var QcloudNamespace = []string{"COS", "CDN"}
80+
7981
type TencentCredential struct {
8082
AccessKey string `yaml:"access_key"`
8183
SecretKey string `yaml:"secret_key"`

pkg/instance/instance_clb.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ type ClbInstance struct {
1515
func (ins *ClbInstance) GetMonitorQueryKey() string {
1616
if len(ins.meta.LoadBalancerVips) == 1 {
1717
return *ins.meta.LoadBalancerVips[0]
18+
} else if *ins.meta.AddressIPv6 != "" {
19+
return *ins.meta.AddressIPv6
1820
} else {
1921
return ""
2022
}

pkg/instance/repository_clb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ getMoreInstances:
8888
level.Error(repo.logger).Log("msg", "Create clb instance fail", "id", *meta.LoadBalancerId)
8989
continue
9090
}
91-
if meta.LoadBalancerVips == nil || len(meta.LoadBalancerVips) == 0 {
91+
if (meta.LoadBalancerVips == nil || len(meta.LoadBalancerVips) == 0) && meta.AddressIPv6 == nil {
9292
level.Warn(repo.logger).Log("msg", "clb instance no include vip", "id", *meta.LoadBalancerId)
9393
continue
9494
}

pkg/metric/repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (repo *TcmMetricRepositoryImpl) GetSamples(s *TcmSeries, st int64, et int64
133133
}
134134

135135
response := &v20180724.GetMonitorDataResponse{}
136-
if s.Metric.Meta.ProductName == "COS" {
136+
if util.IsStrInList(config.QcloudNamespace, s.Metric.Meta.ProductName) {
137137
response, err = repo.monitorClientInGuangzhou.GetMonitorData(request)
138138
} else {
139139
response, err = repo.monitorClient.GetMonitorData(request)
@@ -185,7 +185,7 @@ func (repo *TcmMetricRepositoryImpl) listSampleByBatch(
185185
request := repo.buildGetMonitorDataRequest(m, seriesList, st, et)
186186

187187
response := &v20180724.GetMonitorDataResponse{}
188-
if m.Meta.ProductName == "COS" {
188+
if util.IsStrInList(config.QcloudNamespace, m.Meta.ProductName) {
189189
response, err = repo.monitorClientInGuangzhou.GetMonitorData(request)
190190
} else {
191191
response, err = repo.monitorClient.GetMonitorData(request)

0 commit comments

Comments
 (0)