Skip to content

Commit

Permalink
remove logger changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin committed Mar 7, 2019
1 parent 7843861 commit 0a551a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 7 additions & 3 deletions metricbeat/module/couchbase/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package cluster

import (
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/metricbeat/helper"
"github.com/elastic/beats/metricbeat/mb"
"github.com/elastic/beats/metricbeat/mb/parse"
Expand All @@ -35,6 +36,8 @@ var (
}.Build()
)

var logger = logp.NewLogger("couchbase.cluster")

// init registers the MetricSet with the central registry.
// The New method will be called after the setup of the module and before starting to fetch data
func init() {
Expand Down Expand Up @@ -65,14 +68,15 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
// Fetch methods implements the data gathering and data conversion to the right
// format. It publishes the event which is then forwarded to the output. In case
// of an error set the Error field of mb.Event or simply call report.Error().
func (m *MetricSet) Fetch(reporter mb.ReporterV2) error {
func (m *MetricSet) Fetch(reporter mb.ReporterV2) {
content, err := m.http.FetchContent()
if err != nil {
return err
logger.Error(err)
reporter.Error(err)
return
}

reporter.Event(mb.Event{
MetricSetFields: eventMapping(content),
})
return nil
}
11 changes: 8 additions & 3 deletions metricbeat/module/couchbase/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package node

import (
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/metricbeat/helper"
"github.com/elastic/beats/metricbeat/mb"
"github.com/elastic/beats/metricbeat/mb/parse"
Expand All @@ -35,6 +36,8 @@ var (
}.Build()
)

var logger = logp.NewLogger("couchbase.node")

// init registers the MetricSet with the central registry.
// The New method will be called after the setup of the module and before starting to fetch data
func init() {
Expand Down Expand Up @@ -65,16 +68,18 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
// Fetch methods implements the data gathering and data conversion to the right
// format. It publishes the event which is then forwarded to the output. In case
// of an error set the Error field of mb.Event or simply call report.Error().
func (m *MetricSet) Fetch(reporter mb.ReporterV2) error {
func (m *MetricSet) Fetch(reporter mb.ReporterV2) {
content, err := m.http.FetchContent()
if err != nil {
return err
logger.Error(err)
reporter.Error(err)
return
}

events := eventsMapping(content)
for _, event := range events {
reporter.Event(mb.Event{MetricSetFields: event})
}

return nil
return
}

0 comments on commit 0a551a7

Please sign in to comment.