Skip to content

Commit

Permalink
[Metricbeat] Fix wrong alias in rabbitmq module (#11284)
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
  • Loading branch information
ruflin committed Mar 18, 2019
1 parent 7454eee commit feaef40
Show file tree
Hide file tree
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
Expand Up @@ -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
Expand Up @@ -20516,16 +20516,6 @@ RabbitMQ module
*`rabbitmq.node.name`*::
+
--
type: keyword
Node name
--
*`rabbitmq.vhost`*::
+
--
Expand All @@ -20546,9 +20536,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.
Expand Down Expand Up @@ -21106,13 +21094,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`*::
Expand Down
5 changes: 0 additions & 5 deletions metricbeat/module/rabbitmq/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
type: group
description: >
fields:
- name: node.name
type: keyword
description: >
Node name
- name: vhost
type: keyword
description: >
Expand Down
4 changes: 1 addition & 3 deletions metricbeat/module/rabbitmq/connection/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions metricbeat/tests/system/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 feaef40

Please sign in to comment.