Use PortOpt for prometheus_port

Because the option defines the TCP port number, using PortOpt allows
us to enforce appropriate validation to ensure a valid port number is
given.

Change-Id: I105ba835f732b445523d7eeb80392775a950297a
This commit is contained in:
Takashi Kajinami 2024-10-20 01:23:03 +09:00
parent a1b4546d29
commit 0fe13c1261

View File

@ -33,8 +33,8 @@ oslo_metrics_configs = [
default='/var/tmp/metrics_collector.sock', # nosec
help='Unix domain socket file to be used'
' to send rpc related metrics'),
cfg.IntOpt('prometheus_port', default=3000,
help='Port number to expose metrics in prometheus format.'),
cfg.PortOpt('prometheus_port', default=3000,
help='Port number to expose metrics in prometheus format.'),
]
cfg.CONF.register_opts(oslo_metrics_configs, group='oslo_metrics')