From 33348b2db3c78023217497998f5efa3f7fa14fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Thu, 18 Apr 2024 11:32:53 +0800 Subject: [PATCH] fix(cloudmon): oracle metric collect (#20052) --- pkg/cloudmon/options/options.go | 5 +++-- pkg/cloudmon/providerdriver/base.go | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/cloudmon/options/options.go b/pkg/cloudmon/options/options.go index d74f88a92be..0fc9aec93d7 100644 --- a/pkg/cloudmon/options/options.go +++ b/pkg/cloudmon/options/options.go @@ -34,8 +34,9 @@ type CloudMonOptions struct { HistoryMetricPullDays int `help:"pull history metrics" default:"-1"` SupportAzureTableStorageMetric bool `help:"support collect azure memory and disk usage metric, there may be additional charges" default:"false"` - CloudAccountCollectMetricsBatchCount int `help:"Cloud Account Collect Metrics Batch Count" default:"10"` - CloudResourceCollectMetricsBatchCount int `help:"Cloud Resource Collect Metrics BatchC ount" default:"40"` + CloudAccountCollectMetricsBatchCount int `help:"Cloud Account Collect Metrics Batch Count" default:"10"` + CloudResourceCollectMetricsBatchCount int `help:"Cloud Resource Collect Metrics BatchC ount" default:"40"` + OracleCloudResourceCollectMetricsBatchCount int `help:"OracleCloud Resource Collect Metrics BatchC ount" default:"1"` } type PingProbeOptions struct { diff --git a/pkg/cloudmon/providerdriver/base.go b/pkg/cloudmon/providerdriver/base.go index 2b5c4634066..3f2f2b572bd 100644 --- a/pkg/cloudmon/providerdriver/base.go +++ b/pkg/cloudmon/providerdriver/base.go @@ -196,7 +196,11 @@ func (self *SCollectByResourceIdDriver) CollectDBInstanceMetrics(ctx context.Con } func (self *SCollectByResourceIdDriver) CollectServerMetrics(ctx context.Context, manager api.CloudproviderDetails, provider cloudprovider.ICloudProvider, res map[string]api.ServerDetails, start, end time.Time) error { - ch := make(chan struct{}, options.Options.CloudResourceCollectMetricsBatchCount) + cnt := options.Options.CloudResourceCollectMetricsBatchCount + if manager.Provider == api.CLOUD_PROVIDER_ORACLE { // oracle 限速 + cnt = options.Options.OracleCloudResourceCollectMetricsBatchCount + } + ch := make(chan struct{}, cnt) defer close(ch) metrics := []influxdb.SMetricData{} var wg sync.WaitGroup