diff --git a/cmd/qcloud-exporter/qcloud_exporter.go b/cmd/qcloud-exporter/qcloud_exporter.go index 80c164f..f340528 100644 --- a/cmd/qcloud-exporter/qcloud_exporter.go +++ b/cmd/qcloud-exporter/qcloud_exporter.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "github.com/prometheus/client_golang/prometheus/collectors" "net/http" "os" "time" @@ -28,8 +29,8 @@ func newHandler(cred common.CredentialIface, c *config.TencentConfig, exporterMetricsRegistry := prometheus.NewRegistry() if includeExporterMetrics { exporterMetricsRegistry.MustRegister( - prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}), - prometheus.NewGoCollector(), + collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}), + collectors.NewGoCollector(), ) } diff --git a/go.mod b/go.mod index dd0d0b6..bf90d5a 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.334 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.334 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cmq v1.0.334 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.634 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.750 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.334 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.413 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.334 diff --git a/go.sum b/go.sum index 61516ed..7ca222a 100644 --- a/go.sum +++ b/go.sum @@ -211,9 +211,6 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tencentcloud/tencentcloud-sdk-go v1.0.485 h1:l1xeZUO2ddcouOpxO7dhkXcmcYembuCG5EZ6O+Cox/o= -github.com/tencentcloud/tencentcloud-sdk-go v1.0.528 h1:6HidDboNfqxPVD6/hSgK4vcw3B/sNLHi8ysAAj70Bsc= -github.com/tencentcloud/tencentcloud-sdk-go v1.0.532 h1:8AmaxcmnFwH5HTcmE9suGsI2CROtiVkNQvot64Y+gv0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.334 h1:GijOjoDBcWXtra6hmzpj4IXOahWmsTE3bwpOcp5VBDw= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.334/go.mod h1:PTp058qpOV//RukBVdYQT962rZg71lIt6eHLK1zdvEc= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb v1.0.413 h1:6cQPfHc3I1pKUj23csRd9P/xxUPcnGRLRK2e5NGqtzc= @@ -231,20 +228,13 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cmq v1.0.334/go.mod h1: github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.413/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.430/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.437 h1:Qa0q6mhOkQ/0RoAqOheJAzPFksAf3jsjOZVt4FGcvyQ= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.437/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.479 h1:3kwDb6p1J3LxmwnNgSSEheemPffo+vMewoDzKysYdig= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.479/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.528 h1:ECUVFkluily8Cr0VHzcKmC0M7PLNqEOkoKoS5DukSmA= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.528/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.531 h1:E8vq0WQBjB3jjtCK3u5DPrWGqlgyQUvQ19EkgBob1A8= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.531/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.534 h1:ZsJCXIZO2KfmEsrVN6a75VncTuaSkD4PNd1iXZ1I8BU= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.534/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.576 h1:6L4MeAnCk1NkuKoSfJvNPxqOrXq/HG9FqV3jl6i5t+w= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.576/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.634 h1:xSW5zhVEl+Lp7gJ9Bah1XUAzpGdLB1JrcFmJ+r16RJw= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.634/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.750 h1:zATJQLrw+i0NRosWvoAZ4FM+GbloqovVJGxLCdcjr/w= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.750/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.334 h1:ulfSODMy8rpKa8MfnTIPbe5HyOArnlB4RJ1qmpj09to= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.334/go.mod h1:AqyM/ZZMD7q5mHBqNY9YImbSpEpoEe7E/vrTbUWX+po= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.413 h1:MomwSkFrSLB16s51Yu1h4JO+p3Pzc1yesIj+oNwAVM0= @@ -253,16 +243,14 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.334 h1:inkOmQwx github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.334/go.mod h1:5WGSrlIZJOhwIqPjjafb6vzrPEZieSHPhPMjjGPXOSU= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dcdb v1.0.334 h1:Xxe889sr1FVhUPPFdZC4Z5IyJObgnGh0ELe+MJH17Mo= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dcdb v1.0.334/go.mod h1:uvcrduqH3pPyyZoZyEX0WXlXIR554ys3ctSsKoeJp64= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.479 h1:Tuo8zLhHaO+AxHlk7WOYGs6j/3bfD3FMNB3fWAgIxWM= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.479/go.mod h1:CNPxkXeOC/vOmu9a/yaxp+2immIjDL/WsGC/H2rcWQA= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.531 h1:U0diLtuiEK8RDjfEh7X/BKetd+OppXWvoCW3CFJCMKE= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.531/go.mod h1:Mwk3VuBuWg6d2JtT5pKXKfNKxYRH1mrWquMcTVZQ7gc= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ecdn v1.0.750 h1:yzja0ZT7+yciVCEgmy7Zsx8lEjTWXtU6KZL+uHuVUXE= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ecdn v1.0.750/go.mod h1:S6u2ljeAetJAa/lFQVQZAvVJWJSNK7V5e6QPqj4LqA0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.334 h1:oXOMQ2EmNjqMfpShQeCrWS5QH2MwrAhJfd0rLJOxccE= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.334/go.mod h1:UegCt4vv9jAlzpgDu31ZJTuRP5T2BTV8w+jZBTsZIzg= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.528 h1:CS8HIQNpfYQogrPR/WEFdVNJX6GIOwDyBzn1IHMb46g= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.528/go.mod h1:J+xFyeGmSCp0x4tXPu5mlAhg2BAYQPIy3fQ4afy26tI= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.534 h1:E/ccMQB7Il/U6Da5jrS4YUxpEZhVatageVdny+xAoMk= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.534/go.mod h1:MNvt4sQeoetKfp8y3Y1iKv4aR+P7Z5khZX5QXG31ULA= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.194/go.mod h1:yrBKWhChnDqNz1xuXdSbWXG56XawEq0G5j1lg4VwBD4= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lighthouse v1.0.334 h1:druwbDkTAvVwEGW4nHVuTuOX0bjk1CtLUDiC3r4gmgY= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lighthouse v1.0.334/go.mod h1:r8txjlw4DjLDZFOpnPC/hOFHr1VckZc0jjBK6XIFLP0= diff --git a/pkg/collector/handler_dsa.go b/pkg/collector/handler_dsa.go new file mode 100644 index 0000000..6cd3a33 --- /dev/null +++ b/pkg/collector/handler_dsa.go @@ -0,0 +1,9 @@ +package collector + +const ( + DsaNamespace = "QCE/DSA" +) + +func init() { + registerHandler(DsaNamespace, defaultHandlerEnabled, NewCdnHandler) +} diff --git a/pkg/config/config.go b/pkg/config/config.go index 15a0906..bc67949 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -2,7 +2,6 @@ package config import ( "fmt" - "io/ioutil" "os" "strings" @@ -70,6 +69,7 @@ var ( "lb_private": "QCE/LB_PRIVATE", "waf": "QCE/WAF", "cfs": "QCE/CFS", + "dsa": "QCE/DSA", } SupportStatisticsTypes = map[string]bool{ @@ -157,7 +157,7 @@ func NewConfig() *TencentConfig { func (c *TencentConfig) LoadFile(filename string) error { c.Filename = filename - content, err := ioutil.ReadFile(c.Filename) + content, err := os.ReadFile(c.Filename) if err != nil { return err } diff --git a/pkg/instance/repository_dsa.go b/pkg/instance/repository_dsa.go new file mode 100644 index 0000000..d075e90 --- /dev/null +++ b/pkg/instance/repository_dsa.go @@ -0,0 +1,5 @@ +package instance + +func init() { + registerRepository("QCE/DSA", NewCdnTcInstanceRepository) +}