From 707012f9b250754099cb8f37a1be1c3642eb99d4 Mon Sep 17 00:00:00 2001 From: kaiyan-sheng Date: Thu, 9 Apr 2020 16:02:15 -0600 Subject: [PATCH] [Metricbeat] allow empty region/zone config param for storage metricset (#17624) (#17643) * allow empty region/zone config param for storage metricset (cherry picked from commit 3b7d29fc4fb37d635cd123e9c0015c50ac4f616a) --- 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 7ce8ce954d60..3135d2966f10 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -196,6 +196,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 ee797482000f..69ac38ca101a 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") }