Skip to content

Commit

Permalink
Cherry-pick elastic#13433 to 7.3: Fix conversions of events with modu…
Browse files Browse the repository at this point in the history
…le fields (elastic#13441)

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 elastic#13432

(cherry picked from commit 71fb53e)
  • Loading branch information
jsoriano committed Sep 3, 2019
1 parent f2be98c commit 7362aa6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix `logstash/node_stats` metricset to also collect `logstash_stats.events.duration_in_millis` field when `xpack.enabled: true` is set. {pull}13082[13082]
- Fix `logstash/node` metricset to also collect `logstash_state.pipeline.representation.{type,version,hash}` fields when `xpack.enabled: true` is set. {pull}13133[13133]
- Check if fields in DBInstance is nil in rds metricset. {pull}13294[13294] {issue}13037[13037]
- Fix module-level fields in Kubernetes metricsets. {pull}13433[13433]
- Fix panic in Redis Key metricset when collecting information from a removed key. {pull}13426[13426]

*Packetbeat*
Expand Down
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 7362aa6

Please sign in to comment.