From 310a96ef2995bec6b9865b6c1885c1ce3a7309da Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 30 Aug 2019 14:48:12 +0200 Subject: [PATCH] Fix conversions of events with module fields (#13433) Metricsets that use special fields like `ModuleDataKey` cannot be directly used as metricset fields of `mb.Event`, they need to be converted using something like the `mb.TransformMapStrToEvent()` helper. Fix #13432 --- metricbeat/module/kubernetes/container/container.go | 2 +- metricbeat/module/kubernetes/node/node.go | 2 +- metricbeat/module/kubernetes/pod/pod.go | 2 +- metricbeat/module/kubernetes/system/system.go | 2 +- metricbeat/module/kubernetes/volume/volume.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/metricbeat/module/kubernetes/container/container.go b/metricbeat/module/kubernetes/container/container.go index 4f0bbaaf3864..ef9bb35d2672 100644 --- a/metricbeat/module/kubernetes/container/container.go +++ b/metricbeat/module/kubernetes/container/container.go @@ -99,7 +99,7 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) { m.enricher.Enrich(events) for _, e := range events { - reporter.Event(mb.Event{MetricSetFields: e}) + reporter.Event(mb.TransformMapStrToEvent("kubernetes", e, nil)) } return diff --git a/metricbeat/module/kubernetes/node/node.go b/metricbeat/module/kubernetes/node/node.go index 4d901d7e89c6..cc545356dbd1 100644 --- a/metricbeat/module/kubernetes/node/node.go +++ b/metricbeat/module/kubernetes/node/node.go @@ -98,7 +98,7 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) { m.enricher.Enrich([]common.MapStr{event}) - reporter.Event(mb.Event{MetricSetFields: event}) + reporter.Event(mb.TransformMapStrToEvent("kubernetes", event, nil)) return } diff --git a/metricbeat/module/kubernetes/pod/pod.go b/metricbeat/module/kubernetes/pod/pod.go index 9cd3ff886215..b65a6a20b6d4 100644 --- a/metricbeat/module/kubernetes/pod/pod.go +++ b/metricbeat/module/kubernetes/pod/pod.go @@ -98,7 +98,7 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) { m.enricher.Enrich(events) for _, e := range events { - reporter.Event(mb.Event{MetricSetFields: e}) + reporter.Event(mb.TransformMapStrToEvent("kubernetes", e, nil)) } return } diff --git a/metricbeat/module/kubernetes/system/system.go b/metricbeat/module/kubernetes/system/system.go index 07625271d9fa..28d17a2bb3a8 100644 --- a/metricbeat/module/kubernetes/system/system.go +++ b/metricbeat/module/kubernetes/system/system.go @@ -89,7 +89,7 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) { } for _, e := range events { - reporter.Event(mb.Event{MetricSetFields: e}) + reporter.Event(mb.TransformMapStrToEvent("kubernetes", e, nil)) } return } diff --git a/metricbeat/module/kubernetes/volume/volume.go b/metricbeat/module/kubernetes/volume/volume.go index df7b9dd594f0..bc9ebb59140d 100644 --- a/metricbeat/module/kubernetes/volume/volume.go +++ b/metricbeat/module/kubernetes/volume/volume.go @@ -83,7 +83,7 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) { events, err := eventMapping(body) for _, e := range events { - reporter.Event(mb.Event{MetricSetFields: e}) + reporter.Event(mb.TransformMapStrToEvent("kubernetes", e, nil)) } return