Allow using file to override metric map
Override the metric map of each datasource as soon as it is created by the manager. This override comes from a file whose path is provided by a setting in config file. Loading at creation time allows the correct datasource be used when get_backend is called, this allows loading a datasource whose metric names get updated outside the watcher's codebase. The function 'load_metric_map' returns empty-dict in any error case. Also in case the file is empty where safe_load is unable finds any yaml documents, it will return None. [1] Some minor refactoring in the test_manager file for readability and added tests for file load and metric override. 1 - https://pyyaml.org/wiki/PyYAMLDocumentation Change-Id: I1df16245f4c7dfd34066f3ab0553cd67154faa58 Implements: blueprint file-based-metric-map
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Allow using file to override metric map. Override the metric map of
|
||||
each datasource as soon as it is created by the manager. This override
|
||||
comes from a file whose path is provided by a setting in config file.
|
||||
The setting is `watcher_decision_engine/metric_map_path`. The file
|
||||
contains a map per datasource whose keys are the metric names as
|
||||
recognized by watcher and the value is the real name of the metric
|
||||
in the datasource. This setting defaults to `/etc/watcher/metric_map.yaml`,
|
||||
and presence of this file is optional.
|
||||
Reference in New Issue
Block a user