Module: Gitlab::PerformanceBar
- Defined in:
- lib/gitlab/performance_bar.rb,
lib/gitlab/performance_bar/stats.rb,
lib/gitlab/performance_bar/logger.rb,
lib/gitlab/performance_bar/with_top_level_warnings.rb,
lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb
Defined Under Namespace
Modules: RedisAdapterWhenPeekEnabled, WithTopLevelWarnings
Classes: Logger, Stats
Constant Summary
collapse
- ALLOWED_USER_IDS_KEY =
'performance_bar_allowed_user_ids:v2'
- EXPIRY_TIME_L1_CACHE =
1.minute
- EXPIRY_TIME_L2_CACHE =
5.minutes
Class Method Summary
collapse
Class Method Details
.allowed_for_user?(user = nil) ⇒ Boolean
13
14
15
16
17
18
19
|
# File 'lib/gitlab/performance_bar.rb', line 13
def self.allowed_for_user?(user = nil)
return true if Rails.env.development?
return true if user&.admin?
return false unless user && allowed_group_id
allowed_user_ids.include?(user.id)
end
|
.allowed_group_id ⇒ Object
21
22
23
|
# File 'lib/gitlab/performance_bar.rb', line 21
def self.allowed_group_id
Gitlab::CurrentSettings.performance_bar_allowed_group_id
end
|
.allowed_user_ids ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
.enabled_for_request? ⇒ Boolean
9
10
11
|
# File 'lib/gitlab/performance_bar.rb', line 9
def self.enabled_for_request?
!Gitlab::SafeRequestStore[:capturing_flamegraph] && Gitlab::SafeRequestStore[:peek_enabled]
end
|
.expire_allowed_user_ids_cache ⇒ Object
rubocop: enable CodeReuse/ActiveRecord
.l1_cache_backend ⇒ Object
.l2_cache_backend ⇒ Object
50
51
52
|
# File 'lib/gitlab/performance_bar.rb', line 50
def self.l2_cache_backend
Rails.cache
end
|