Re-implement `Peek::Views::GC` to process requests only when Performance Bar is active in `production`
Previously, Peek::Views::GC
was enabled in production
ENV and it processed every request even if Performance Bar was not active for a particular user/request.
Internally, Peek::Views::GC
runs GC::Profiler.clear
(https://gitlab.com/gitlab-org/gitlab-ce/issues/63571#note_197251146) and since it was running around every request, we were not able to collect GC metrics for Prometheus.
The solution was to enable Peek::Views::GC
only in development
: https://gitlab.com/gitlab-org/gitlab-ce/issues/63571#note_198284803
Nevertheless, we may want to get the GC data in production
, similar to what Peek::Views::GC
provided, but collect it only when Performance Bar is enabled for the request. We could re-implement Peek::Views::GC
to make it possible.
It's still a matter of discussion, since it may not make much sense for multi-threaded env in production
.
I am linking this ticket to the peek.rb
config to make it easy discovering the intentions for disabling it.