Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #13544 to 7.2: Fix conversion of events with module fields #13554

Merged
merged 1 commit into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ https://github.com/elastic/beats/compare/v7.2.0...7.2[Check the HEAD diff]
*Metricbeat*

- Print errors that were being omitted in vSphere metricsets {pull}12816[12816]
- Fix module-level fields in Kubernetes metricsets. {pull}13433[13433]
- Fix module-level fields in Kubernetes metricsets. {pull}13433[13433] {pull}13544[13544]
- Fix panic in Redis Key metricset when collecting information from a removed key. {pull}13426[13426]

*Packetbeat*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
[
{
"RootFields": null,
"RootFields": {},
"ModuleFields": null,
"MetricSetFields": {
"cpu": {
"allocatable": {
"cores": 3
"cores": 2
},
"capacity": {
"cores": 4
"cores": 2
}
},
"memory": {
"allocatable": {
"bytes": 3097786880
"bytes": 2097786880
},
"capacity": {
"bytes": 4097786880
"bytes": 2097786880
}
},
"name": "minikube-test",
"name": "minikube",
"pod": {
"allocatable": {
"total": 210
"total": 110
},
"capacity": {
"total": 310
"total": 110
}
},
"status": {
"ready": "true",
"unschedulable": true
"unschedulable": false
}
},
"Index": "",
Expand All @@ -40,40 +40,42 @@
"Error": null,
"Host": "",
"Service": "",
"Took": 0
"Took": 0,
"Period": 0,
"DisableTimeSeries": false
},
{
"RootFields": null,
"RootFields": {},
"ModuleFields": null,
"MetricSetFields": {
"cpu": {
"allocatable": {
"cores": 2
"cores": 3
},
"capacity": {
"cores": 2
"cores": 4
}
},
"memory": {
"allocatable": {
"bytes": 2097786880
"bytes": 3097786880
},
"capacity": {
"bytes": 2097786880
"bytes": 4097786880
}
},
"name": "minikube",
"name": "minikube-test",
"pod": {
"allocatable": {
"total": 110
"total": 210
},
"capacity": {
"total": 110
"total": 310
}
},
"status": {
"ready": "true",
"unschedulable": false
"unschedulable": true
}
},
"Index": "",
Expand All @@ -83,6 +85,8 @@
"Error": null,
"Host": "",
"Service": "",
"Took": 0
"Took": 0,
"Period": 0,
"DisableTimeSeries": false
}
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"RootFields": null,
"RootFields": {},
"ModuleFields": null,
"MetricSetFields": {
"cpu": {
Expand Down Expand Up @@ -40,6 +40,8 @@
"Error": null,
"Host": "",
"Service": "",
"Took": 0
"Took": 0,
"Period": 0,
"DisableTimeSeries": false
}
]
10 changes: 6 additions & 4 deletions metricbeat/module/kubernetes/state_node/state_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) {

m.enricher.Enrich(events)
for _, event := range events {
reporter.Event(mb.Event{
MetricSetFields: event,
Namespace: "kubernetes.node",
})
event[mb.NamespaceKey] = "node"
reported := reporter.Event(mb.TransformMapStrToEvent("kubernetes", event, nil))
if !reported {
m.Logger().Debug("error trying to emit event")
return
}
}
}

Expand Down