Commit Graph

18 Commits

Author SHA1 Message Date
GitLab Bot fb73ca3398 Add latest changes from gitlab-org/gitlab@master 2019-12-27 15:08:16 +00:00
GitLab Bot 8cc5f27909 Add latest changes from gitlab-org/gitlab@master 2019-12-13 12:07:41 +00:00
GitLab Bot 0a850868df Add latest changes from gitlab-org/gitlab@master 2019-10-09 12:06:13 +00:00
GitLab Bot bd860c22f6 Add latest changes from gitlab-org/gitlab@master 2019-09-17 12:06:48 +00:00
dineshpanda e908e11776 Avoid calling freeze on already frozen strings in lib/gitlab 2019-09-04 09:52:02 +05:30
Thong Kuah c5acf26e06 Fix frozen string errors 2019-08-23 00:17:11 +12:00
Stan Hu 9225eb13ca Add additional paths to clean from backtrace
`Gitlab::Profiler` can also be used to profile Sidekiq jobs.
Add some call traces that can be omitted from the backtrace.
2019-07-31 23:07:42 -07:00
Stan Hu 07a308ad1b Enable Rubocop Performance/ReverseEach
`Array.reverse_each` is faster than `Array.reverse.each` because:

* reverse.each creates a new array then loops each element
* reverse_each loops in reverse order (no intermediate array created)
2019-07-24 14:08:25 -07:00
Stan Hu 266ba11ed7 Fix Profiler to work with Ruby 5.1
Ruby 5.1 now requires keyword arguments to pass along parameters and
headers for ActionDispatch::Integration::RequestHelpers.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/61051
2019-04-26 21:22:23 -07:00
Stan Hu fbb3fd1397 Add backtrace to Gitaly performance bar
This adds the backtrace to a table to show exactly where the Gitaly call
was made to make it easier to understand where the call originated.

This change also collapses the details in the same row to improve the
usability when there is a backtrace.
2019-04-17 04:45:24 -07:00
Sean McGivern f1a7e7fea1 Allow profiler to authenticate by stubbing users directly
Previously, we used a personal access token. This had a couple of
problems:

1. If the user didn't have a PAT, we couldn't impersonate them.
2. It depended on reading the raw PAT from the database.

Instead, we can monkey-patch the authentication methods on
ApplicationController (overriding the Devise ones), and remove them once
we're done. This does mean that profiles will not profile auth
correctly, so for that, use a PAT directly.
2018-11-26 11:18:03 +00:00
gfyoung c858f70d07 Enable frozen string for lib/gitlab/*.rb 2018-10-22 07:00:50 +00:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Sean McGivern ef973f6f28 Add a Gitlab::Profiler.print_by_total_time convenience method
This method uses Gitlab::Profiler::TotalTimeFlatPrinter internally, which is the
same as RubyProf::FlatPrinter, but the min_percent option (and new max_percent
option) applies to the _total_ time, not the _self_ time. This helps us figure
out if we're calling a library inefficiently, for instance.
2018-07-19 16:00:27 +01:00
Sean McGivern d304f88352 Expose a clean_backtrace method from Gitlab::Profiler
This method makes it easier for other parts of the app to get clean backtraces,
as well as console users.
2018-06-15 13:29:55 +01:00
Sean McGivern e236180618 Add query counts by model to profiler output 2018-03-21 17:18:33 +00:00
Dylan Griffith bda4f0811e Improve error handling for Gitlab::Profiler and improve doc about providing a user 2018-02-16 19:47:44 +11:00
Sean McGivern b16c0080ac Add Gitlab::Profiler for profiling from a console or runner
Gitlab::Profiler.profile takes a URL to profile, and returns the ruby-prof
profile result.

This is currently only for interactive use (in a console) or from the script
runner. Note that when using this interactively, changes to the application
within that console session will be used, so this can be used to test proposed
performance changes.
2018-01-19 12:31:54 +00:00