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

Add missing namespace field in http server metricset #7890

Merged
merged 1 commit into from
Aug 7, 2018
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
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff]

- Fix golang.heap.gc.cpu_fraction type from long to float in Golang module. {pull}7789[7789]
- Fixed a panic when the kvm module cannot establish a connection to libvirtd. {issue}7792[7792].
- Add missing namespace field in http server metricset {pull}7890[7890]

*Packetbeat*

Expand Down
14 changes: 9 additions & 5 deletions metricbeat/module/http/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
package server

import (
"github.com/elastic/beats/libbeat/common"
"fmt"

"github.com/elastic/beats/libbeat/common/cfgwarn"
serverhelper "github.com/elastic/beats/metricbeat/helper/server"
"github.com/elastic/beats/metricbeat/helper/server/http"
Expand Down Expand Up @@ -83,10 +84,13 @@ func (m *MetricSet) Run(reporter mb.PushReporterV2) {
reporter.Error(err)
} else {
event := mb.Event{}
event.ModuleFields = common.MapStr{}
metricSetName := fields[mb.NamespaceKey].(string)
delete(fields, mb.NamespaceKey)
event.ModuleFields.Put(metricSetName, fields)
ns, ok := fields[mb.NamespaceKey].(string)
if ok {
ns = fmt.Sprintf("http.%s", ns)
delete(fields, mb.NamespaceKey)
}
event.MetricSetFields = fields
event.Namespace = ns
reporter.Event(event)
}

Expand Down