Commit Graph

37 Commits

Author SHA1 Message Date
GitLab Bot 61a82b8ec0 Add latest changes from gitlab-org/gitlab@master 2022-11-14 12:08:03 +00:00
GitLab Bot 70eb0cf751 Add latest changes from gitlab-org/gitlab@master 2022-08-10 12:12:15 +00:00
GitLab Bot 475d5a7a17 Add latest changes from gitlab-org/gitlab@master 2022-03-03 00:20:18 +00:00
GitLab Bot bc2f7ab125 Add latest changes from gitlab-org/gitlab@master 2021-10-13 09:11:55 +00:00
GitLab Bot cb787abec6 Add latest changes from gitlab-org/gitlab@master 2021-10-11 12:11:56 +00:00
GitLab Bot a84626f13d Add latest changes from gitlab-org/gitlab@master 2021-10-05 15:12:53 +00:00
GitLab Bot e5e0589e09 Add latest changes from gitlab-org/gitlab@master 2021-04-26 12:09:44 +00:00
GitLab Bot a156fc95eb Add latest changes from gitlab-org/gitlab@master 2021-03-25 12:09:19 +00:00
GitLab Bot c46b011d3f Add latest changes from gitlab-org/gitlab@master 2021-03-23 15:09:28 +00:00
GitLab Bot 213bd7e9d3 Add latest changes from gitlab-org/gitlab@master 2021-02-18 12:09:34 +00:00
GitLab Bot bf217da41b Add latest changes from gitlab-org/gitlab@master 2021-02-11 21:09:00 +00:00
GitLab Bot 559d99e402 Add latest changes from gitlab-org/gitlab@master 2021-02-11 18:09:10 +00:00
GitLab Bot f807b28f17 Add latest changes from gitlab-org/gitlab@master 2021-01-29 03:08:52 +00:00
GitLab Bot a6c51b8876 Add latest changes from gitlab-org/gitlab@master 2021-01-11 21:10:36 +00:00
GitLab Bot e91cb68359 Add latest changes from gitlab-org/gitlab@master 2020-12-09 15:10:12 +00:00
GitLab Bot 7cdd70dcec Add latest changes from gitlab-org/gitlab@master 2019-11-28 15:06:57 +00:00
Rémy Coutable b7398bc1fd Merge branch 'fix-peek-on-puma' into 'master'
Fix Peek on Puma

Closes #66528

See merge request gitlab-org/gitlab-ce!32213
2019-09-02 08:43:21 +00:00
Sean McGivern f9c456bd0c Make performance bar enabled checks consistent
Previously, we called the `peek_enabled?` method like so:

    prepend_before_action :set_peek_request_id, if: :peek_enabled?

Now we don't have a `set_peek_request_id` method, so we don't need that
line. However, the `peek_enabled?` part had a side-effect: it would also
populate the request store cache for whether the performance bar was
enabled for the current request or not.

This commit makes that side-effect explicit, and replaces all uses of
`peek_enabled?` with the more explicit
`Gitlab::PerformanceBar.enabled_for_request?`. There is one spec that
still sets `SafeRequestStore[:peek_enabled]` directly, because it is
contrasting behaviour with and without a request store enabled.

The upshot is:

1. We still set the value in one place. We make it more explicit that
   that's what we're doing.
2. Reading that value uses a consistent method so it's easier to find in
   future.
2019-08-28 17:25:02 +01:00
Sean McGivern 9bfb012a56 Add top-level warnings key to performance bar response
This key is useful to reduce the amount of logic needed on the frontend:
if `has_warnings` is true, then the frontend knows that the request in
question has warnings for some metric.
2019-08-28 16:39:33 +01:00
Sean McGivern 7f102819a5 Fix Peek on Puma
Peek's `Peek.request_id` method doesn't work well with a multi-threaded
server and concurrent requests, because requests can 'steal' another
request's ID, or unset it before it was due.

The upstream change resolves this; the commit here is just to ensure
that GitLab works with that upstream change, mostly by not using
`Peek.request_id` any more (as the method doesn't exist).
2019-08-27 14:15:25 +01:00
Sean McGivern ad1c71663f Replace peek-pg with our own implementation
This uses an ActiveRecord subscriber to get queries and calculate the
total query time from that. This means that the total will always be
consistent with the queries in the table. It does however mean that we
could potentially miss some queries that don't go through ActiveRecord.

Making this change also allows us to unify the response JSON a little
bit, making the frontend slightly simpler as a result.
2019-07-26 14:37:26 +01:00
Rémy Coutable eaf58debac
Only save Peek session in Redis when Peek is enabled
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-07-03 16:02:42 +02:00
Stan Hu 8346da6527 Add backtraces to Peek performance bar for SQL calls
Just as we have backtraces for Gitaly, we should also have backtraces
for SQL calls. This makes it much easier to find the source of the SQL
call and optimize N+1 queries and other performance issues with an
endpoint.
2019-06-09 18:19:40 -07:00
Jasper Maes 624a1cdab4 Upgrade Rails to 5.1.6.1
Model.new.attributes now also returns encrypted attributes.
2019-04-23 08:31:23 +08:00
gfyoung f93f8f569d Enable even more frozen string for lib/gitlab
Enables frozen string for the following:

* lib/gitlab/patch/**/*.rb
* lib/gitlab/popen/**/*.rb
* lib/gitlab/profiler/**/*.rb
* lib/gitlab/project_authorizations/**/*.rb
* lib/gitlab/prometheus/**/*.rb
* lib/gitlab/query_limiting/**/*.rb
* lib/gitlab/quick_actions/**/*.rb
* lib/gitlab/redis/**/*.rb
* lib/gitlab/request_profiler/**/*.rb
* lib/gitlab/search/**/*.rb
* lib/gitlab/sherlock/**/*.rb
* lib/gitlab/sidekiq_middleware/**/*.rb
* lib/gitlab/slash_commands/**/*.rb
* lib/gitlab/sql/**/*.rb
* lib/gitlab/template/**/*.rb
* lib/gitlab/testing/**/*.rb
* lib/gitlab/utils/**/*.rb
* lib/gitlab/webpack/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
2018-11-19 18:24:22 -08:00
Michael Kozono f107bc69e3 Simplify by using Gitlab::SafeRequestStore
These are clear wins.
2018-09-24 12:11:26 -07:00
Yorick Peterse 58058ce0ca
Fix SQL timings for the performance bar
My recent change accidentally changed the reported time from
milliseconds to seconds, resulting in wrong timings being displayed.
2017-11-03 15:45:58 +01:00
Yorick Peterse 189b5c3c39
Remove Sherlock usage from the performance bar
Sherlock::Query generates a backtrace on every call to "new", which is
very slow. Formatter queries are also not displayed properly due to the
lack of "white-space: pre" in the CSS. We took a look at fixing this,
but the produced output is not really better than just displaying
queries on one line.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/39351
2017-10-23 14:59:07 +03:00
Sean McGivern 1c7893c5c1 Merge branch 'rc/bump-peek-performance_bar' into 'master'
Bump peek-performance_bar to 1.3.0 and get rid of a monkey-patch

See merge request !12939
2017-07-19 08:52:01 +00:00
Rémy Coutable 3dcd3df531
Fix queries duration sorting in Performance Bar
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-18 19:00:46 +02:00
Rémy Coutable 66c7f51897
Bump peek-performance_bar to 1.3.0 and get rid of a monkey-patch
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-18 13:56:36 +02:00
Rémy Coutable 32eaf46ead
Don't track cached queries in Gitlab::PerformanceBar::PeekQueryTracker
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-17 16:44:00 +02:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Rémy Coutable d1b4576a79 Ensure peek-performance_bar doesn't break existing functionalities
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-09 17:21:39 +02:00
Rémy Coutable e859145329 Fix Rubocop offenses, improve SQL duration format and changelog entry
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-09 17:21:39 +02:00
Rémy Coutable 651eb51ece Display queries duration in performance bar queries modal
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-09 17:21:39 +02:00
Rémy Coutable 46273e1446 Store Sherlock::Query in Peek adapter
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-09 17:21:39 +02:00