summaryrefslogtreecommitdiff
path: root/config/initializers/peek.rb
blob: 6cb0e711e486e96e0ef86c855dd4988cf03913ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Redis.params) }

Peek.into Peek::Views::Host
Peek.into Peek::Views::PerformanceBar
Peek.into Gitlab::Database.mysql? ? Peek::Views::Mysql2 : Peek::Views::PG
Peek.into Peek::Views::Redis
Peek.into Peek::Views::Sidekiq
Peek.into Peek::Views::Rblineprof
Peek.into Peek::Views::GC

if Gitlab::Database.mysql?
  class Mysql2::Client
    class << self
      attr_accessor :query_details
    end
    self.query_details = Concurrent::Array.new
  end

  module Peek
    module Views
      class Mysql2 < View
        prepend ::Gitlab::PerformanceBar::PeekMysqlWithQueries
      end
    end
  end
else
  class PG::Connection
    class << self
      attr_accessor :query_details
    end
    self.query_details = Concurrent::Array.new
  end

  module Peek
    module Views
      class PG < View
        prepend ::Gitlab::PerformanceBar::PeekPgWithQueries
      end
    end
  end
end