Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/qcloud-cvm-product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ products:
all_instances: true
#only_include_metrics: []
#only_include_instances: [ins-xxxxxxxx]
#extra_labels: [InstanceName]
#extra_labels: [InstanceId, InstanceName]
#statistics_types: [last]
#period_seconds: 60
#metric_name_type: 2
6 changes: 4 additions & 2 deletions pkg/collector/handler_clb.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package collector
import (
"github.com/go-kit/kit/log"
"github.com/tencentyun/tencentcloud-exporter/pkg/metric"
"github.com/tencentyun/tencentcloud-exporter/pkg/util"
)

const (
Expand All @@ -19,9 +20,10 @@ type clbHandler struct {
}

func (h *clbHandler) CheckMetricMeta(meta *metric.TcmMeta) bool {
if len(meta.SupportDimensions) == 0 {
meta.SupportDimensions = append(meta.SupportDimensions, "vip")
if !util.IsStrInList(meta.SupportDimensions, ClbInstanceidKey) {
meta.SupportDimensions = append(meta.SupportDimensions, ClbInstanceidKey)
}

return true
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/collector/handler_clb7.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ type clb7Handler struct {
}

func (h *clb7Handler) CheckMetricMeta(meta *metric.TcmMeta) bool {
meta.SupportDimensions = append(meta.SupportDimensions, "vip")
if !util.IsStrInList(meta.SupportDimensions, Clb7InstanceidKey) {
meta.SupportDimensions = append(meta.SupportDimensions, Clb7InstanceidKey)
}

return true
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/collector/handler_cvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ type cvmHandler struct {
}

func (h *cvmHandler) CheckMetricMeta(meta *metric.TcmMeta) bool {
if !util.IsStrInList(meta.SupportDimensions, CvmInstanceidKey) {
meta.SupportDimensions = append(meta.SupportDimensions, CvmInstanceidKey)
}

return true
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/instance/repository_cdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (repo *CdbTcInstanceRepository) ListByFilters(filters map[string]string) (i
var limit uint64 = 2000
var total int64 = -1

req.Offset = &offset
req.Limit = &limit

getMoreInstances:
Expand All @@ -70,6 +71,7 @@ getMoreInstances:
}
offset += limit
if offset < uint64(total) {
req.Offset = &offset
goto getMoreInstances
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/instance/repository_clb.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func (repo *ClbTcInstanceRepository) ListByFilters(filters map[string]string) (i
var offset int64 = 0
var limit int64 = 100
var total int64 = -1

req.Offset = &offset
req.Limit = &limit

getMoreInstances:
Expand All @@ -83,6 +85,7 @@ getMoreInstances:
}
offset += limit
if offset < total {
req.Offset = &offset
goto getMoreInstances
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/instance/repository_cvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (repo *CvmTcInstanceRepository) ListByFilters(filters map[string]string) (i
var limit int64 = 100
var total int64 = -1

req.Offset = &offset
req.Limit = &limit

getMoreInstances:
Expand All @@ -70,6 +71,7 @@ getMoreInstances:
}
offset += limit
if offset < total {
req.Offset = &offset
goto getMoreInstances
}
return
Expand Down
2 changes: 2 additions & 0 deletions pkg/instance/repository_dc.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (repo *DcTcInstanceRepository) ListByFilters(filters map[string]string) (in
var limit int64 = 100
var total int64 = -1

req.Offset = &offset
req.Limit = &limit

getMoreInstances:
Expand All @@ -70,6 +71,7 @@ getMoreInstances:
}
offset += limit
if offset < total {
req.Offset = &offset
goto getMoreInstances
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/instance/repository_dcx.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (repo *DcxTcInstanceRepository) ListByFilters(filters map[string]string) (i
var offset int64 = 0
var limit int64 = 100
var total int64 = -1
req.Offset = &offset
req.Limit = &limit

getMoreInstances:
Expand All @@ -69,6 +70,7 @@ getMoreInstances:
}
offset += limit
if offset < total {
req.Offset = &offset
goto getMoreInstances
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/instance/repository_mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (repo *MongoTcInstanceRepository) ListByFilters(filters map[string]string)
var limit uint64 = 100
var total int64 = -1

req.Offset = &offset
req.Limit = &limit

if v, ok := filters["ProjectId"]; ok {
Expand Down Expand Up @@ -82,6 +83,7 @@ getMoreInstances:
}
offset += limit
if offset < uint64(total) {
req.Offset = &offset
goto getMoreInstances
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/instance/repository_nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (repo *NatTcInstanceRepository) ListByFilters(filters map[string]string) (i
var offset uint64 = 0
var limit uint64 = 100
var total int64 = -1
req.Offset = &offset
req.Limit = &limit

getMoreInstances:
Expand All @@ -69,6 +70,7 @@ getMoreInstances:
}
offset += limit
if offset < uint64(total) {
req.Offset = &offset
goto getMoreInstances
}
return
Expand Down
3 changes: 2 additions & 1 deletion pkg/instance/repository_redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (repo *RedisTcInstanceRepository) ListByFilters(filters map[string]string)
var offset uint64 = 0
var limit uint64 = 100
var total int64 = -1

req.Offset = &offset
req.Limit = &limit

getMoreInstances:
Expand All @@ -70,6 +70,7 @@ getMoreInstances:
}
offset += limit
if offset < uint64(total) {
req.Offset = &offset
goto getMoreInstances
}

Expand Down