Commit graph

14 commits

Author SHA1 Message Date
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
Thong Kuah
8c42a0eac0 Add frozen_string_literal to lib part 2
Using the sed script from
https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-08-23 00:15:24 +12:00
Heinrich Lee Yu
1ce5bcacdb Remove code related to object hierarchy in MySQL
These are not required because MySQL is not
supported anymore
2019-07-25 15:35:06 +08:00
Rémy Coutable
d0b76d0652
Cache PerformanceBar.allowed_user_ids list locally and in Redis
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-07-03 18:47:30 +02:00
Robert Speicher
eb9e09bb1a Always allow the performance bar to be enabled for admins 2018-04-02 14:19:19 -05:00
Paul Charlton
cb3b4a15e6 Support multiple Redis instances based on queue type 2017-07-11 03:35:47 +00:00
Rémy Coutable
97611c88fc
Don't use Flipper for the Performance Bar
The implementation now simply rely on the
`performance_bar_allowed_group_id` Application Setting.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-07 02:34:51 +02:00
Rémy Coutable
040eeb1039
Allow to enable the Performance Bar for a group from the admin area
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-06 18:57:02 +02:00
Rémy Coutable
de9eca0af6
Use Rails.cache instead of Redis directly
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-06 17:11:20 +02:00
Rémy Coutable
00ac76cc4c Cache the allowed user IDs for the performance bar, in Redis for 10 minutes
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-06 11:18:26 +02:00
Rémy Coutable
cdc1179fac Improve feature flag check for the performance bar
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-06 11:18:26 +02:00
Rémy Coutable
19b8d8af2c Hide 'peek' by using 'performance bar' instead
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-06 11:18:25 +02:00
Rémy Coutable
b531616eba Cache PerformanceBar data using RequestStore
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-06 11:18:25 +02:00
Rémy Coutable
186048a404 Allow to enable the performance bar per user or Flipper group
A `performance_team` Flipper group has been created. By default this
group is nil but this can be customized in `gitlab.yml` via the
performance_bar.allowed_group setting.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-06 11:18:25 +02:00