Coverage for watcher/conf/grafana_translators.py: 100%

8 statements  

« 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. 

18 

19from oslo_config import cfg 

20 

21grafana_translators = cfg.OptGroup(name='grafana_translators', 

22 title='Configuration Options for Grafana ' 

23 'transalators') 

24 

25GRAFANA_TRANSLATOR_INFLUX_OPTS = [ 

26 cfg.DictOpt('retention_periods', 

27 default={ 

28 'one_week': 604800, 

29 'one_month': 2592000, 

30 'five_years': 31556952 

31 }, 

32 help="Keys are the names of retention periods in InfluxDB and " 

33 "the values should correspond with the maximum time they " 

34 "can retain in seconds. Example: {'one_day': 86400}")] 

35 

36 

37def register_opts(conf): 

38 conf.register_group(grafana_translators) 

39 conf.register_opts(GRAFANA_TRANSLATOR_INFLUX_OPTS, 

40 group=grafana_translators) 

41 

42 

43def list_opts(): 

44 return [(grafana_translators, GRAFANA_TRANSLATOR_INFLUX_OPTS)]