summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/with_performance_bar.rb
blob: 230bbe4b1aa84ed44fbf8142a78a80cd759f2740 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module WithPerformanceBar
  extend ActiveSupport::Concern

  included do
    include Peek::Rblineprof::CustomControllerHelpers
  end

  def peek_enabled?
    return true if Rails.env.development?
    return false unless Gitlab::PerformanceBar.enabled?(current_user)

    if RequestStore.active?
      RequestStore.fetch(:peek_enabled) { cookies[:perf_bar_enabled].present? }
    else
      cookies[:perf_bar_enabled].present?
    end
  end
end