Allow for global datasources preference from config
Allows to define a global preference for metric datasources with the ability for strategy specific overrides. In addition, strategies which do not require datasources have the config options removed this is done to prevent confusion. Some documentation that details the inner workings of selecting datasources is updated. Imports for some files in watcher/common have been changed to resolve circular dependencies and now match the overall method to import configuration. Addtional datasources will be retrieved by the manager if the datasource throws an error. Implements: blueprint global-datasource-preference Change-Id: I6fc455b288e338c20d2c4cfec5a0c95350bebc36
This commit is contained in:
@@ -285,8 +285,15 @@ The following code snippet shows how datasource_backend is defined:
|
||||
@property
|
||||
def datasource_backend(self):
|
||||
if not self._datasource_backend:
|
||||
|
||||
# Load the global preferred datasources order but override it
|
||||
# if the strategy has a specific datasources config
|
||||
datasources = CONF.watcher_datasources
|
||||
if self.config.datasources:
|
||||
datasources = self.config
|
||||
|
||||
self._datasource_backend = ds_manager.DataSourceManager(
|
||||
config=self.config,
|
||||
config=datasources,
|
||||
osc=self.osc
|
||||
).get_backend(self.DATASOURCE_METRICS)
|
||||
return self._datasource_backend
|
||||
|
||||
Reference in New Issue
Block a user