Skip to content

Commit

Permalink
[Metricbeat] Fix wrong alias in rabbitmq module (#11284) (#11289)
Browse files Browse the repository at this point in the history
* rabbitmq.node.name was duplicated and alias pointed to itself
* rabbitmq.connection.name was falsely migrated to `rabbitmq.name`

Also adding tests to Filebeat and Metricbeat to ensure this does not happen again in the future.

Closes #11271

(cherry picked from commit feaef40)
  • Loading branch information
ruflin authored Mar 18, 2019
1 parent 712f1db commit 5bdf992
Showing 7 changed files with 44 additions and 30 deletions.
16 changes: 16 additions & 0 deletions filebeat/tests/system/test_base.py
Original file line number Diff line number Diff line change
@@ -40,3 +40,19 @@ def test_template(self):
assert exit_code == 0
assert self.log_contains('Loaded index template')
assert len(es.cat.templates(name='filebeat-*', h='name')) > 0

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_template_migration(self):
"""
Test that the template can be loaded with `setup --template`
"""
es = Elasticsearch([self.get_elasticsearch_url()])
self.render_config_template(
elasticsearch={"host": self.get_elasticsearch_url()},
)
exit_code = self.run_beat(extra_args=["setup", "--template",
"-E", "setup.template.overwrite=true", "-E", "migration.enabled=true"])

assert exit_code == 0
assert self.log_contains('Loaded index template')
assert len(es.cat.templates(name='filebeat-*', h='name')) > 0
19 changes: 2 additions & 17 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
@@ -20073,16 +20073,6 @@ RabbitMQ module
*`rabbitmq.node.name`*::
+
--
type: keyword
Node name
--
*`rabbitmq.vhost`*::
+
--
@@ -20103,9 +20093,7 @@ connection
*`rabbitmq.connection.name`*::
+
--
type: alias
alias to: rabbitmq.name
type: keyword
The name of the connection with non-ASCII characters escaped as in C.
@@ -20663,13 +20651,10 @@ Number of messages which have been written to the message store.
*`rabbitmq.node.name`*::
+
--
type: alias
alias to: rabbitmq.node.name
type: keyword
Node name
--
*`rabbitmq.node.proc.total`*::
5 changes: 0 additions & 5 deletions metricbeat/module/rabbitmq/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -9,11 +9,6 @@
type: group
description: >
fields:
- name: node.name
type: keyword
description: >
Node name
- name: vhost
type: keyword
description: >
4 changes: 1 addition & 3 deletions metricbeat/module/rabbitmq/connection/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -5,9 +5,7 @@
release: ga
fields:
- name: name
type: alias
path: rabbitmq.name
migration: true
type: keyword
description: >
The name of the connection with non-ASCII characters escaped as in C.
- name: vhost
2 changes: 1 addition & 1 deletion metricbeat/module/rabbitmq/fields.go

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

6 changes: 2 additions & 4 deletions metricbeat/module/rabbitmq/node/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -111,10 +111,8 @@
description: >
Number of messages which have been written to the message store.
- name: name
type: alias
path: rabbitmq.node.name
migration: true
description: >
type: keyword
description:
Node name
- name: proc.total
type: long
22 changes: 22 additions & 0 deletions metricbeat/tests/system/test_base.py
Original file line number Diff line number Diff line change
@@ -75,3 +75,25 @@ def test_dashboards(self):

assert exit_code == 0
assert self.log_contains("Kibana dashboards successfully loaded.")

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_migration(self):
"""
Test that the template loads when migration is enabled
"""

es = Elasticsearch([self.get_elasticsearch_url()])
self.render_config_template(
modules=[{
"name": "apache",
"metricsets": ["status"],
"hosts": ["localhost"],
}],
elasticsearch={"host": self.get_elasticsearch_url()},
)
exit_code = self.run_beat(extra_args=["setup", "--template",
"-E", "setup.template.overwrite=true", "-E", "migration.enabled=true"])

assert exit_code == 0
assert self.log_contains('Loaded index template')
assert len(es.cat.templates(name='metricbeat-*', h='name')) > 0

0 comments on commit 5bdf992

Please sign in to comment.