gitlab-org--gitlab-foss/config/initializers/peek.rb
Jan Provaznik 9930ab6ab8 Remove peek-sidekiq
The reason for removing this gem is that it's not being maintained
anymore. It uses `alias_method_chain` which is deprecated in rails 5
(and removed in 5.1), the issue is pending upstream (including
a fix) - https://github.com/suranyami/peek-sidekiq/issues/3 for a while.

Peek-sidekiq is used in performance bar for displaying sidekiq
statistics.
2018-09-12 10:13:19 +02:00

31 lines
820 B
Ruby

Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Redis::Cache.params) }
Peek.into Peek::Views::Host
if Gitlab::Database.mysql?
require 'peek-mysql2'
PEEK_DB_CLIENT = ::Mysql2::Client
PEEK_DB_VIEW = Peek::Views::Mysql2
elsif Gitlab::Database.postgresql?
require 'peek-pg'
PEEK_DB_CLIENT = ::PG::Connection
PEEK_DB_VIEW = Peek::Views::PG
else
raise "Unsupported database adapter for peek!"
end
Peek.into PEEK_DB_VIEW
Peek.into Peek::Views::Gitaly
Peek.into Peek::Views::Rblineprof
Peek.into Peek::Views::Redis
Peek.into Peek::Views::GC
# rubocop:disable Naming/ClassAndModuleCamelCase
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