From 378a347caacdf3b480d89d7924332d4cb9db9ffa Mon Sep 17 00:00:00 2001 From: ruflin Date: Wed, 4 Apr 2018 10:46:09 +0200 Subject: [PATCH] Set all metricsets as default in etcd module --- metricbeat/docs/modules/etcd.asciidoc | 5 +---- metricbeat/metricbeat.reference.yml | 1 - metricbeat/module/etcd/_meta/config.reference.yml | 4 ++++ metricbeat/module/etcd/_meta/config.yml | 3 --- metricbeat/module/etcd/_meta/docs.asciidoc | 2 +- metricbeat/module/etcd/leader/leader.go | 7 ++++--- metricbeat/module/etcd/self/self.go | 7 ++++--- metricbeat/module/etcd/store/store.go | 7 ++++--- metricbeat/modules.d/etcd.yml.disabled | 3 --- 9 files changed, 18 insertions(+), 21 deletions(-) create mode 100644 metricbeat/module/etcd/_meta/config.reference.yml diff --git a/metricbeat/docs/modules/etcd.asciidoc b/metricbeat/docs/modules/etcd.asciidoc index 7396e8e679ee..79f8c31cd35e 100644 --- a/metricbeat/docs/modules/etcd.asciidoc +++ b/metricbeat/docs/modules/etcd.asciidoc @@ -9,7 +9,7 @@ beta[] This is the Etcd Module. The Etcd module uses https://coreos.com/etcd/docs/latest/v2/api.html [Etcd v2 API] to collect metrics. - +The default metricsets are `leader`, `self` and `store`. [float] @@ -22,10 +22,7 @@ in <>. Here is an example configuration: ---- metricbeat.modules: - module: etcd - metricsets: ["leader", "self", "store"] - period: 10s hosts: ["localhost:2379"] - ---- This module supports TLS connection when using `ssl` config field, as described in <>. diff --git a/metricbeat/metricbeat.reference.yml b/metricbeat/metricbeat.reference.yml index 548d0bad0fd2..f4bc6cfa97cb 100644 --- a/metricbeat/metricbeat.reference.yml +++ b/metricbeat/metricbeat.reference.yml @@ -188,7 +188,6 @@ metricbeat.modules: period: 10s hosts: ["localhost:2379"] - #------------------------------- Golang Module ------------------------------- - module: golang metricsets: ["expvar","heap"] diff --git a/metricbeat/module/etcd/_meta/config.reference.yml b/metricbeat/module/etcd/_meta/config.reference.yml new file mode 100644 index 000000000000..f269a2b7ccee --- /dev/null +++ b/metricbeat/module/etcd/_meta/config.reference.yml @@ -0,0 +1,4 @@ +- module: etcd + metricsets: ["leader", "self", "store"] + period: 10s + hosts: ["localhost:2379"] diff --git a/metricbeat/module/etcd/_meta/config.yml b/metricbeat/module/etcd/_meta/config.yml index 6a5d97c63407..38142c4a03a9 100644 --- a/metricbeat/module/etcd/_meta/config.yml +++ b/metricbeat/module/etcd/_meta/config.yml @@ -1,5 +1,2 @@ - module: etcd - metricsets: ["leader", "self", "store"] - period: 10s hosts: ["localhost:2379"] - diff --git a/metricbeat/module/etcd/_meta/docs.asciidoc b/metricbeat/module/etcd/_meta/docs.asciidoc index c346daa5e1e3..06493114846d 100644 --- a/metricbeat/module/etcd/_meta/docs.asciidoc +++ b/metricbeat/module/etcd/_meta/docs.asciidoc @@ -1,3 +1,3 @@ This is the Etcd Module. The Etcd module uses https://coreos.com/etcd/docs/latest/v2/api.html [Etcd v2 API] to collect metrics. - +The default metricsets are `leader`, `self` and `store`. diff --git a/metricbeat/module/etcd/leader/leader.go b/metricbeat/module/etcd/leader/leader.go index 5cf1d96e6dbe..415c4c5558ff 100644 --- a/metricbeat/module/etcd/leader/leader.go +++ b/metricbeat/module/etcd/leader/leader.go @@ -21,9 +21,10 @@ var ( ) func init() { - if err := mb.Registry.AddMetricSet("etcd", "leader", New, hostParser); err != nil { - panic(err) - } + mb.Registry.MustAddMetricSet("etcd", "leader", New, + mb.WithHostParser(hostParser), + mb.DefaultMetricSet(), + ) } type MetricSet struct { diff --git a/metricbeat/module/etcd/self/self.go b/metricbeat/module/etcd/self/self.go index b98ef548070d..f890c98edd1f 100644 --- a/metricbeat/module/etcd/self/self.go +++ b/metricbeat/module/etcd/self/self.go @@ -21,9 +21,10 @@ var ( ) func init() { - if err := mb.Registry.AddMetricSet("etcd", "self", New, hostParser); err != nil { - panic(err) - } + mb.Registry.MustAddMetricSet("etcd", "self", New, + mb.WithHostParser(hostParser), + mb.DefaultMetricSet(), + ) } type MetricSet struct { diff --git a/metricbeat/module/etcd/store/store.go b/metricbeat/module/etcd/store/store.go index d4b99a889c14..842fb4c26832 100644 --- a/metricbeat/module/etcd/store/store.go +++ b/metricbeat/module/etcd/store/store.go @@ -21,9 +21,10 @@ var ( ) func init() { - if err := mb.Registry.AddMetricSet("etcd", "store", New, hostParser); err != nil { - panic(err) - } + mb.Registry.MustAddMetricSet("etcd", "store", New, + mb.WithHostParser(hostParser), + mb.DefaultMetricSet(), + ) } type MetricSet struct { diff --git a/metricbeat/modules.d/etcd.yml.disabled b/metricbeat/modules.d/etcd.yml.disabled index 6a5d97c63407..38142c4a03a9 100644 --- a/metricbeat/modules.d/etcd.yml.disabled +++ b/metricbeat/modules.d/etcd.yml.disabled @@ -1,5 +1,2 @@ - module: etcd - metricsets: ["leader", "self", "store"] - period: 10s hosts: ["localhost:2379"] -