Commit 25420de6 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-add-backtrace-to-sql-queries' into 'master'

Add backtraces to Peek performance bar for SQL calls

See merge request gitlab-org/gitlab-ce!29394
parents b7ebcbc0 8346da65
---
title: Add backtraces to Peek performance bar for SQL calls
merge_request:
author:
type: added
......@@ -27,15 +27,16 @@ module Gitlab
subscribe('sql.active_record') do |_, start, finish, _, data|
if Gitlab::SafeRequestStore.store[:peek_enabled]
unless data[:cached]
track_query(data[:sql].strip, data[:binds], start, finish)
backtrace = Gitlab::Profiler.clean_backtrace(caller)
track_query(data[:sql].strip, data[:binds], backtrace, start, finish)
end
end
end
end
def track_query(raw_query, bindings, start, finish)
def track_query(raw_query, bindings, backtrace, start, finish)
duration = (finish - start) * 1000.0
query_info = { duration: duration.round(3), sql: raw_query }
query_info = { duration: duration.round(3), sql: raw_query, backtrace: backtrace }
PEEK_DB_CLIENT.query_details << query_info
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