From d4e5b338e1f98ae3efd5d61240ba6ae78b893540 Mon Sep 17 00:00:00 2001 From: sayden Date: Wed, 30 Jan 2019 11:44:36 +0100 Subject: [PATCH] Move service.version to the zookeeper level --- metricbeat/docs/fields.asciidoc | 9 +++++++++ metricbeat/module/zookeeper/_meta/fields.yml | 3 +++ metricbeat/module/zookeeper/fields.go | 2 +- metricbeat/module/zookeeper/server/server.go | 2 +- .../module/zookeeper/server/server_integration_test.go | 2 +- metricbeat/tests/system/test_zookeeper.py | 2 ++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index f7299d7e3631..f22faa4c57c0 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -21399,6 +21399,15 @@ ZooKeeper metrics collected by the four-letter monitoring commands. +*`zookeeper.service.version`*:: ++ +-- +type: keyword + +The version of the zookeeper node. + +-- + [float] == mntr fields diff --git a/metricbeat/module/zookeeper/_meta/fields.yml b/metricbeat/module/zookeeper/_meta/fields.yml index 99ad281a2fb5..24408339311a 100644 --- a/metricbeat/module/zookeeper/_meta/fields.yml +++ b/metricbeat/module/zookeeper/_meta/fields.yml @@ -11,3 +11,6 @@ `zookeeper` contains the metrics reported by ZooKeeper commands. fields: + - name: service.version + type: keyword + description: The version of the zookeeper node. diff --git a/metricbeat/module/zookeeper/fields.go b/metricbeat/module/zookeeper/fields.go index 1efe71cd2b80..8ebf1dd60a25 100644 --- a/metricbeat/module/zookeeper/fields.go +++ b/metricbeat/module/zookeeper/fields.go @@ -31,5 +31,5 @@ func init() { // Asset returns asset data func Asset() string { - return "eJy0mM2O4zYMx+95CmIve9p5gBwKFN0eimJ3gWlPe/EyMhMLkUVXpPMxT1/Ijhw7sTOZfPg0sEf8/0iRIpUvsKb9HN6Y10QVhRmAWnU0h08/mf9u3n2aAeQkJthKLfs5/DYDAOi+Q0karBEw7BwZpRwWe9CCYMl1+OJINf4Te6scrF+B4bJ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2lnJTrxHwox8yyTquXBzu+jHG/v+N3cx2sm5228ulRM7gKF9vQn1Kx46xEBo3tZugDzyex9EPnN51ajPUGAd/fv7XDoenF49BP6rW2AUojOVt7X8D1Z0Pedfdfl7DusqpO8z69v4Nzmg52Zxz5bxe1m52tk8txgxwgXpb2ZOks55gYkPA8AvcWY2zfaz+wWnOcmiHyhlujheD3ZazwsK73uwW+vRwQ5dOQGvAb1gda7BP19mTs7byrIHIS2B2jfETVPBJpv5JeH8y6W4f8eVF+74dwAAAP//gk/VGA==" } diff --git a/metricbeat/module/zookeeper/server/server.go b/metricbeat/module/zookeeper/server/server.go index f73d6904fcd3..f1c2a2324cff 100644 --- a/metricbeat/module/zookeeper/server/server.go +++ b/metricbeat/module/zookeeper/server/server.go @@ -89,7 +89,7 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) { event := mb.Event{ MetricSetFields: metricsetFields, - RootFields: common.MapStr{ + ModuleFields: common.MapStr{ "service": common.MapStr{ "version": version, }, diff --git a/metricbeat/module/zookeeper/server/server_integration_test.go b/metricbeat/module/zookeeper/server/server_integration_test.go index 7c5d4abecbc4..75b8beb9940c 100644 --- a/metricbeat/module/zookeeper/server/server_integration_test.go +++ b/metricbeat/module/zookeeper/server/server_integration_test.go @@ -48,7 +48,7 @@ func TestFetch(t *testing.T) { metricsetFields := event.MetricSetFields // Check values - assert.Equal(t, "06/29/2018 04:05 GMT", metricsetFields["version_date"]) + assert.Equal(t, "02/06/2016 03:18 GMT", metricsetFields["version_date"]) received := metricsetFields["received"].(int64) assert.True(t, received >= 0) diff --git a/metricbeat/tests/system/test_zookeeper.py b/metricbeat/tests/system/test_zookeeper.py index fc71f40a2715..25ff4d830b48 100644 --- a/metricbeat/tests/system/test_zookeeper.py +++ b/metricbeat/tests/system/test_zookeeper.py @@ -71,6 +71,8 @@ def test_output(self): self.assertEqual(len(output), 1) evt = output[0] + self.assertItemsEqual(self.de_dot(ZK_FIELDS), evt.keys()) + zk_srvr = evt["zookeeper"]["server"] assert zk_srvr["connections"] >= 0