-
Bob Van Landuyt authored
This would cause us to keep track of a reference of all metrics on the class level. Which would mean we would keep looking at the old metrics the registry in that we kept track of in [Prometheus::Client::Registry#metrics][0] after it was reset using[Gitlab::Metrics.reset_registry][1]. This wouldn't cause any issues in production, because the metrics are never reset. But in specs, we do count on those being reset in between runs. This is safe to do, because the registry itself is memoized on [Gitlab::Metrics][2]. Getting the specific metric is an [initialization the first time around][3], but after a registry is memoized, it's just a [read from a hash][4]. [0] https://gitlab.com/gitlab-org/prometheus-client-mmap/-/blob/9e5b696dfd47a96cf22808cbebb04f00cd3d4ffc/lib/prometheus/client/registry.rb#L17 [1] https://gitlab.com/gitlab-org/gitlab/blob/82db58bab85531e49fa7264d6461928d49425a6e/lib/gitlab/metrics/prometheus.rb#L30 [2] https://gitlab.com/gitlab-org/gitlab/blob/82db58bab85531e49fa7264d6461928d49425a6e/lib/gitlab/metrics/prometheus.rb#L39 [3] https://gitlab.com/gitlab-org/gitlab/blob/82db58bab85531e49fa7264d6461928d49425a6e/lib/gitlab/metrics/prometheus.rb#L87 [4] https://gitlab.com/gitlab-org/prometheus-client-mmap/-/blob/9e5b696dfd47a96cf22808cbebb04f00cd3d4ffc/lib/prometheus/client/registry.rb#L56
c4f15e21