Fix Kibana plugin config duplication

This commit fixes the problem of the Kibana plugin's instances
list getting appended to every time monasca-setup runs. See
the referenced story for details. It also adds a cautionary
note on avoiding the problem to plugin development
documentation.

Change-Id: I7c82028ad31798dcfe88e77c97c41da87c9743fa
Story: 2001311
Task: 5865
This commit is contained in:
Johannes Grassler 2017-11-23 10:04:25 +01:00 committed by Witold Bedyk
parent 7e548f40b0
commit 530599c705
2 changed files with 8 additions and 1 deletions

View File

@ -205,7 +205,13 @@ In the init_config section you can specify an arbitrary number of global name:va
##### instances
The instances section is a list of instances that this check will be run against. Your actual check() method is run once per instance. The name:value pairs for each instance specify details about the instance that are necessary for the check.
It is best practice to include a name for each instance as the monasca-setup program uses this to avoid duplicating instances.
It is vitally important to have a `name` attribute with a unique value for each
instance as the `monasca-setup` program uses this to avoid duplicating
instances. If any of the instances does not have a `name` attribute,
`monasca-setup` will duplicate it every time it runs, causing not only a
cluttered configuration file but also a multiplication of metrics sent by the
plugin. See https://storyboard.openstack.org/#!/story/2001311 for an example of
the plugin where this problem occurred.
#### DynamicCheckHelper class

View File

@ -132,6 +132,7 @@ class Kibana(detection.Plugin):
},
'instances': [
{
"name": kibana_url,
'metrics': metrics
}
]