From 7b6cfad6ad3f767ed277bd23317d63449173ec27 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:54:22 +0530 Subject: [PATCH] [8.14](backport #40467) x-pack/metricbeat/module/gcp: Fix missing ECS labels when using exclude_labels: true (#40595) * x-pack/metricbeat/module/gcp: Fix missing ECS labels when using exclude_labels: true (#40467) * Issue fix * Change.log * resolved comments * fix (cherry picked from commit 973af491a7bbf1095235cd6f310b190a116ceac5) * Update CHANGELOG.next.asciidoc Co-authored-by: Andrew Kroh --------- Co-authored-by: Linu-Elias Co-authored-by: Andrew Kroh --- CHANGELOG.next.asciidoc | 1 + x-pack/metricbeat/module/gcp/metrics/metricset.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 332a1e8e458..2e347b5f17f 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -99,6 +99,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Fix missing metrics from CloudWatch when include_linked_accounts set to false. {issue}40071[40071] {pull}40135[40135] - Update beat module with apm-server monitoring metrics fields {pull}40127[40127] - Fix Azure Monitor metric timespan to restore Storage Account PT1H metrics {issue}40376[40376] {pull}40367[40367] +- Add missing ECS Cloud fields in GCP `metrics` metricset when using `exclude_labels: true` {issue}40437[40437] {pull}40467[40467] *Osquerybeat* diff --git a/x-pack/metricbeat/module/gcp/metrics/metricset.go b/x-pack/metricbeat/module/gcp/metrics/metricset.go index 49cdce5d73a..eb4e3c57fd3 100644 --- a/x-pack/metricbeat/module/gcp/metrics/metricset.go +++ b/x-pack/metricbeat/module/gcp/metrics/metricset.go @@ -212,7 +212,7 @@ func (m *MetricSet) Fetch(ctx context.Context, reporter mb.ReporterV2) (err erro func (m *MetricSet) mapToEvents(ctx context.Context, timeSeries []timeSeriesWithAligner, sdc metricsConfig) ([]mb.Event, error) { mapper := newIncomingFieldMapper(m.Logger(), sdc) - var metadataService = gcp.NewStackdriverMetadataServiceForTimeSeries(nil) + var metadataService gcp.MetadataService var err error if !m.config.ExcludeLabels {