Skip to content

Commit

Permalink
Merge pull request #78 from zianazhao/master
Browse files Browse the repository at this point in the history
fix:
1、lb-ipv6:负载均衡支持查询ipv6版实例
2、cdn-qcloud:修复cdn通用区数据
  • Loading branch information
zero3233 authored Oct 18, 2022
2 parents 750f43c + 2353fa5 commit aab0248
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ var (
}
)

var QcloudNamespace = []string{"COS", "CDN"}

type TencentCredential struct {
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
Expand Down
2 changes: 2 additions & 0 deletions pkg/instance/instance_clb.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type ClbInstance struct {
func (ins *ClbInstance) GetMonitorQueryKey() string {
if len(ins.meta.LoadBalancerVips) == 1 {
return *ins.meta.LoadBalancerVips[0]
} else if *ins.meta.AddressIPv6 != "" {
return *ins.meta.AddressIPv6
} else {
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/instance/repository_clb.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ getMoreInstances:
level.Error(repo.logger).Log("msg", "Create clb instance fail", "id", *meta.LoadBalancerId)
continue
}
if meta.LoadBalancerVips == nil || len(meta.LoadBalancerVips) == 0 {
if (meta.LoadBalancerVips == nil || len(meta.LoadBalancerVips) == 0) && meta.AddressIPv6 == nil {
level.Warn(repo.logger).Log("msg", "clb instance no include vip", "id", *meta.LoadBalancerId)
continue
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/metric/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (repo *TcmMetricRepositoryImpl) GetSamples(s *TcmSeries, st int64, et int64
}

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

response := &v20180724.GetMonitorDataResponse{}
if m.Meta.ProductName == "COS" {
if util.IsStrInList(config.QcloudNamespace, m.Meta.ProductName) {
response, err = repo.monitorClientInGuangzhou.GetMonitorData(request)
} else {
response, err = repo.monitorClient.GetMonitorData(request)
Expand Down

0 comments on commit aab0248

Please sign in to comment.