Commit 179676ae authored by Sean McGivern's avatar Sean McGivern

Include all queries in the performance bar summary

Rails 5.1's `exec_no_cache` doesn't call `async_exec` any more, but
`exec_params`: https://github.com/rails/rails/pull/33188

This means that the DB summary in the performance bar was wrong. The
individual query details were still correct (we subscribe to
ActiveRecord events for those).

We can remove this once the upstream PR to peek-pg is in a release and
we update to use that release.
parent 9f8123d9
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment