diff --git a/metricbeat/module/couchbase/cluster/cluster.go b/metricbeat/module/couchbase/cluster/cluster.go index e2366b3f272..735ef159930 100644 --- a/metricbeat/module/couchbase/cluster/cluster.go +++ b/metricbeat/module/couchbase/cluster/cluster.go @@ -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" @@ -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() { @@ -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 } diff --git a/metricbeat/module/couchbase/node/node.go b/metricbeat/module/couchbase/node/node.go index c06da22b747..84a0dad9fd9 100644 --- a/metricbeat/module/couchbase/node/node.go +++ b/metricbeat/module/couchbase/node/node.go @@ -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" @@ -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() { @@ -65,10 +68,12 @@ 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) @@ -76,5 +81,5 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) error { reporter.Event(mb.Event{MetricSetFields: event}) } - return nil + return }