diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-29 19:27:57 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-29 19:27:57 +0300 |
commit | 7064d48e2b74d5a92a16278085f3a0b46274911d (patch) | |
tree | c247a9decd0d06923d8051f0f408aa9b239aa3ad /config | |
parent | 6686cd35039a84b123799b468dbf1b7b2e5f2a6e (diff) | |
parent | ad1c71663f7780838c7c90979419f3e3cf5ec580 (diff) |
Merge branch 'remove-peek-pg' into 'master'
Replace peek-pg with our own implementation
Closes #44441
See merge request gitlab-org/gitlab-ce!31187
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/peek.rb | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb index 8416ae430c7..d51d553c939 100644 --- a/config/initializers/peek.rb +++ b/config/initializers/peek.rb @@ -1,44 +1,14 @@ -Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Redis::Cache.params) } - -Peek.into Peek::Views::Host +require 'peek/adapters/redis' -if Gitlab::Database.postgresql? - require 'peek-pg' - PEEK_DB_CLIENT = ::PG::Connection - PEEK_DB_VIEW = Peek::Views::PG +Peek::Adapters::Redis.prepend ::Gitlab::PerformanceBar::RedisAdapterWhenPeekEnabled - # Remove once we have https://github.com/peek/peek-pg/pull/10 - module ::Peek::PGInstrumented - def exec_params(*args) - start = Time.now - super(*args) - ensure - duration = (Time.now - start) - PEEK_DB_CLIENT.query_time.update { |value| value + duration } - PEEK_DB_CLIENT.query_count.update { |value| value + 1 } - end - end -else - raise "Unsupported database adapter for peek!" -end +Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Redis::Cache.params) } -Peek.into PEEK_DB_VIEW +Peek.into Peek::Views::Host +Peek.into Peek::Views::ActiveRecord Peek.into Peek::Views::Gitaly Peek.into Peek::Views::Rblineprof Peek.into Peek::Views::RedisDetailed Peek.into Peek::Views::Rugged Peek.into Peek::Views::GC Peek.into Peek::Views::Tracing if Labkit::Tracing.tracing_url_enabled? - -# 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 - -require 'peek/adapters/redis' -Peek::Adapters::Redis.prepend ::Gitlab::PerformanceBar::RedisAdapterWhenPeekEnabled |