Review `Gitlab::Profiler` and take action
https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/profiler.rb
- Does it work? Yes, as long as the rubyprof call does not time out
-
Is it used? Yes, according to the survey, 3 (out of 17) people use(d)
Gitlab::Profiler
(before) -
Is it helpful? Yes, profiling a page is helpful. Ruby-prof might not work great with ruby 3, and it times out on huge pages. So we might look into that, perhaps switch to
stackprof
? -
It is easy to use? Yes, the
bin/profile-url
script makes this very easy.
What does GitLab::Profiler do and (how) do we use it?
You can call GitLab::Profiler.profile
with a URL. It will then run RubyProf.profile
on that URL and return the RubyProf profiling report (as HTML)
There is also GitLab::Profiler.with_user
, which wraps the block with a logged in user
It can easily be used by running the bin/profile-url
script like so:
bin/profile-url flightjs/Flight/-/merge_requests/4/diffs --user=root --output=/tmp/profile.html --sql=/tmp/profile_sql.txt
A lot of info can be found on the docs:
Docs: https://docs.gitlab.com/ee/development/profiling.html
In short: The Gitlab::Profiler
looks very useful for local profiling. The only possible issue is that it uses 'rubyprof', but we might have to switch that to stackprof
when we switch to Ruby 3.0