Skip to content

Commit

Permalink
Move service.version to the zookeeper level
Browse files Browse the repository at this point in the history
  • Loading branch information
sayden committed Jan 30, 2019
1 parent 69ab6a2 commit d4e5b33
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
9 changes: 9 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/zookeeper/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
`zookeeper` contains the metrics reported by ZooKeeper
commands.
fields:
- name: service.version

This comment has been minimized.

Copy link
@ruflin

ruflin Jan 30, 2019

Member

This should be one level up before zookeeper so it's still on the top level.

type: keyword
description: The version of the zookeeper node.
2 changes: 1 addition & 1 deletion metricbeat/module/zookeeper/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion metricbeat/module/zookeeper/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) {

event := mb.Event{
MetricSetFields: metricsetFields,
RootFields: common.MapStr{
ModuleFields: common.MapStr{

This comment has been minimized.

Copy link
@ruflin

ruflin Jan 30, 2019

Member

Sorry, this was a misunderstanding. Field should be on the top level as it was before, I mentioned the module fields.yml to put it there, see comment above.

"service": common.MapStr{
"version": version,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions metricbeat/tests/system/test_zookeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d4e5b33

Please sign in to comment.