Skip to content

Commit

Permalink
Fix conversions of events with module fields (#13433)
Browse files Browse the repository at this point in the history
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

(cherry picked from commit 310a96e)
  • Loading branch information
jsoriano committed Aug 30, 2019
1 parent b4976bf commit 121edbf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion metricbeat/module/kubernetes/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/kubernetes/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/kubernetes/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/kubernetes/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion metricbeat/module/kubernetes/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 121edbf

Please sign in to comment.