Refactor simplify rack metrics for elasticsearch/redis
Firstly we move the initialization of the metrics into initialize so that they aren't invoked multiple times. Secondly we remove the conditional logic which is avoiding adding metrics when metrics are disabled. This is not necessary because these [rack middleware are only inserted when metrics are enabled](https://gitlab.com/gitlab-org/gitlab/-/blob/9c8f75e10b4dff4d3d13c6cf1ab75c0da252a352/config/initializers/zz_metrics.rb#L136) and there will always be a transaction present as it is [unconditionally created in `Gitlab::Metrics::RackMiddleware`](https://gitlab.com/gitlab-org/gitlab/-/blob/9c8f75e10b4dff4d3d13c6cf1ab75c0da252a352/lib/gitlab/metrics/rack_middleware.rb#L13).
Showing
Please register or sign in to comment