2017-09-10 17:25:29 +05:30
|
|
|
Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Redis::Cache.params) }
|
|
|
|
|
|
|
|
Peek.into Peek::Views::Host
|
|
|
|
Peek.into Peek::Views::PerformanceBar
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
if Gitlab::Database.mysql?
|
|
|
|
require 'peek-mysql2'
|
|
|
|
PEEK_DB_CLIENT = ::Mysql2::Client
|
|
|
|
PEEK_DB_VIEW = Peek::Views::Mysql2
|
2018-03-17 18:26:18 +05:30
|
|
|
elsif Gitlab::Database.postgresql?
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'peek-pg'
|
|
|
|
PEEK_DB_CLIENT = ::PG::Connection
|
|
|
|
PEEK_DB_VIEW = Peek::Views::PG
|
2018-03-17 18:26:18 +05:30
|
|
|
else
|
|
|
|
raise "Unsupported database adapter for peek!"
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
Peek.into PEEK_DB_VIEW
|
2018-05-09 12:01:36 +05:30
|
|
|
Peek.into Peek::Views::Gitaly
|
|
|
|
Peek.into Peek::Views::Rblineprof
|
2017-09-10 17:25:29 +05:30
|
|
|
Peek.into Peek::Views::Redis
|
|
|
|
Peek.into Peek::Views::Sidekiq
|
|
|
|
Peek.into Peek::Views::GC
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
# rubocop:disable Naming/ClassAndModuleCamelCase
|
2017-09-10 17:25:29 +05:30
|
|
|
class PEEK_DB_CLIENT
|
|
|
|
class << self
|
|
|
|
attr_accessor :query_details
|
|
|
|
end
|
|
|
|
self.query_details = Concurrent::Array.new
|
|
|
|
end
|
|
|
|
|
|
|
|
PEEK_DB_VIEW.prepend ::Gitlab::PerformanceBar::PeekQueryTracker
|