diff options
author | Stan Hu <stanhu@gmail.com> | 2019-05-03 13:01:50 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-05-03 13:01:50 +0000 |
commit | 01f2186e0bfe79d6eb8f0ce3fa8b81d5ceb47ebe (patch) | |
tree | 13a5f4e4f294a7728b86248f42f76545c1040c82 | |
parent | 22aa45c8f290f9bcf2cefa194e9d2c25e366f8c5 (diff) | |
parent | 179676aecb73244b352da9e85a981bc0df66ab4b (diff) | |
download | gitlab-ce-01f2186e0bfe79d6eb8f0ce3fa8b81d5ceb47ebe.tar.gz |
Merge branch 'include-all-postgres-queries-in-performance-bar-summary' into 'master'
Include all queries in the performance bar summary
Closes #61372
See merge request gitlab-org/gitlab-ce!28063
-rw-r--r-- | config/initializers/peek.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb index eeb45fae753..cb108416b10 100644 --- a/config/initializers/peek.rb +++ b/config/initializers/peek.rb @@ -10,6 +10,18 @@ elsif Gitlab::Database.postgresql? require 'peek-pg' PEEK_DB_CLIENT = ::PG::Connection PEEK_DB_VIEW = Peek::Views::PG + + # 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 |