Coverage for watcher/conf/datasources.py: 100%
10 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
1# -*- encoding: utf-8 -*-
2# Copyright (c) 2019 European Organization for Nuclear Research (CERN)
3#
4# Authors: Corne Lukken <info@dantalion.nl>
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15# implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
19from oslo_config import cfg
21from watcher.decision_engine.datasources import manager
23datasources = cfg.OptGroup(name='watcher_datasources',
24 title='Configuration Options for watcher'
25 ' datasources')
27possible_datasources = list(manager.DataSourceManager.metric_map.keys())
29DATASOURCES_OPTS = [
30 cfg.ListOpt("datasources",
31 help="Datasources to use in order to query the needed metrics."
32 " If one of strategy metric is not available in the first"
33 " datasource, the next datasource will be chosen. This is"
34 " the default for all strategies unless a strategy has a"
35 " specific override.",
36 item_type=cfg.types.String(choices=possible_datasources),
37 default=possible_datasources),
38 cfg.IntOpt('query_max_retries',
39 min=1,
40 default=10,
41 mutable=True,
42 help='How many times Watcher is trying to query again',
43 deprecated_group="gnocchi_client"),
44 cfg.IntOpt('query_timeout',
45 min=0,
46 default=1,
47 mutable=True,
48 help='How many seconds Watcher should wait to do query again',
49 deprecated_group="gnocchi_client")
50 ]
53def register_opts(conf):
54 conf.register_group(datasources)
55 conf.register_opts(DATASOURCES_OPTS, group=datasources)
58def list_opts():
59 return [(datasources, DATASOURCES_OPTS)]