The openstacksdk documentation states that if applications want to
opt-in to Prometheus metrics provided by openstacksdk,
collector_registry should have a prometheus_client.CollectorRegistry
object passed to it when instantiating the openstack.Connection object.
However, with the way it is currently implemented, openstacksdk will
use the global prometheus_client.REGISTRY object if collector_registry
was not set to a non-None value. This means that if the
prometheus-client package is installed, but not configured in
openstacksdk, openstacksdk *always* publishes metrics to the global
Prometheus collector registry, even if it is not used.
This not only has the potential to cause unintended pollution of
the global Prometheus collector registry with unwanted metrics,
it also can be a potential cause of memory leaks if openstacksdk
is used to make a large amount/variety of requests. This potentially
affects a wide variety of OpenStack services due to oslo.messaging
depending on oslo.metrics, which requires prometheus-client.
Change-Id: Iab6fde785d9a7fb44088e951e5e8c3bc398a621f
Closes-Bug: 2137505
Signed-off-by: Callum Dickinson <callum.dickinson@catalystcloud.nz>