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

8 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-17 12:22 +0000

1# Copyright 2024 Red Hat, Inc. 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); you may 

4# not use this file except in compliance with the License. You may obtain 

5# a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

12# License for the specific language governing permissions and limitations 

13# under the License. 

14# 

15 

16from oslo_config import cfg 

17 

18prometheus_client = cfg.OptGroup(name='prometheus_client', 

19 title='Configuration Options for Prometheus', 

20 help="See https://docs.openstack.org/watcher/" 

21 "latest/datasources/prometheus.html for " 

22 "details on how these options are used.") 

23 

24PROMETHEUS_CLIENT_OPTS = [ 

25 cfg.StrOpt('host', 

26 help="The hostname or IP address for the prometheus server."), 

27 cfg.StrOpt('port', 

28 help="The port number used by the prometheus server."), 

29 cfg.StrOpt('fqdn_label', 

30 default="fqdn", 

31 help="The label that Prometheus uses to store the fqdn of " 

32 "exporters. Defaults to 'fqdn'."), 

33 cfg.StrOpt('instance_uuid_label', 

34 default="resource", 

35 help="The label that Prometheus uses to store the uuid of " 

36 "OpenStack instances. Defaults to 'resource'."), 

37 cfg.StrOpt('username', 

38 help="The basic_auth username to use to authenticate with the " 

39 "Prometheus server."), 

40 cfg.StrOpt('password', 

41 secret=True, 

42 help="The basic_auth password to use to authenticate with the " 

43 "Prometheus server."), 

44 cfg.StrOpt('cafile', 

45 help="Path to the CA certificate for establishing a TLS " 

46 "connection with the Prometheus server."), 

47 cfg.StrOpt('certfile', 

48 help="Path to the client certificate for establishing a TLS " 

49 "connection with the Prometheus server."), 

50 cfg.StrOpt('keyfile', 

51 help="Path to the client key for establishing a TLS " 

52 "connection with the Prometheus server."), 

53] 

54 

55 

56def register_opts(conf): 

57 conf.register_group(prometheus_client) 

58 conf.register_opts(PROMETHEUS_CLIENT_OPTS, group=prometheus_client) 

59 

60 

61def list_opts(): 

62 return [(prometheus_client, PROMETHEUS_CLIENT_OPTS)]