Use StrongMemoize for memoizing state of Prometheus metrics
What does this MR do and why?
If Prometheus metrics were disabled in the application settings,
previously the prometheus_metrics_enabled? check would not be memoized
properly. As a result, we could get into a situation where a database
query is needed to check the state of the Prometheus metrics while the
load balancing connections are being set up.
Normally the state of Prometheus metrics should be set up properly by
the Puma master worker, but if it is set to false the database will
repeatedly be checked.
To properly memoize false values, use strong_memoize_attr and
clear_memoization.
References
Relates to https://gitlab.com/gitlab-com/request-for-help/-/issues/3317
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.