Skip to content

Commit

Permalink
Add missing namespace field in http server metricset
Browse files Browse the repository at this point in the history
  • Loading branch information
vjsamuel committed Aug 7, 2018
1 parent 551b2a9 commit dacaa08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit dacaa08

Please sign in to comment.