From 3b7d29fc4fb37d635cd123e9c0015c50ac4f616a Mon Sep 17 00:00:00 2001 From: kaiyan-sheng Date: Thu, 9 Apr 2020 09:04:57 -0600 Subject: [PATCH] [Metricbeat] allow empty region/zone config param for storage metricset (#17624) * allow empty region/zone config param for storage metricset --- CHANGELOG.next.asciidoc | 1 + .../metricbeat/module/googlecloud/stackdriver/metricset.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 9f9d4ac9c47..4e8a363ef01 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -153,6 +153,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Metricbeat no longer needs to be started strictly after Logstash for `logstash-xpack` module to report correct data. {issue}17261[17261] {pull}17497[17497] - Add privileged option so as mb to access data dir in Openshift. {pull}17606[17606] - Fix "ID" event generator of Google Cloud module {issue}17160[17160] {pull}17608[17608] +- Fix storage metricset to allow config without region/zone. {issue}17623[17623] {pull}17624[17624] *Packetbeat* diff --git a/x-pack/metricbeat/module/googlecloud/stackdriver/metricset.go b/x-pack/metricbeat/module/googlecloud/stackdriver/metricset.go index ee797482000..69ac38ca101 100644 --- a/x-pack/metricbeat/module/googlecloud/stackdriver/metricset.go +++ b/x-pack/metricbeat/module/googlecloud/stackdriver/metricset.go @@ -148,6 +148,11 @@ func validatePeriodForGCP(d time.Duration) (err error) { } func (c *config) Validate() error { + // storage metricset does not require region or zone config parameter. + if c.ServiceName == "storage" { + return nil + } + if c.Region == "" && c.Zone == "" { return errors.New("region and zone in Google Cloud config file cannot both be empty") }