diff options
Diffstat (limited to 'lib/peek')
-rw-r--r-- | lib/peek/views/active_record.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/peek/views/active_record.rb b/lib/peek/views/active_record.rb index 77108bb81ca..523e673e9e1 100644 --- a/lib/peek/views/active_record.rb +++ b/lib/peek/views/active_record.rb @@ -39,16 +39,20 @@ module Peek super subscribe('sql.active_record') do |_, start, finish, _, data| - if Gitlab::PerformanceBar.enabled_for_request? - detail_store << { - duration: finish - start, - sql: data[:sql].strip, - backtrace: Gitlab::BacktraceCleaner.clean_backtrace(caller), - cached: data[:cached] ? 'cached' : '' - } - end + detail_store << generate_detail(start, finish, data) if Gitlab::PerformanceBar.enabled_for_request? end end + + def generate_detail(start, finish, data) + { + duration: finish - start, + sql: data[:sql].strip, + backtrace: Gitlab::BacktraceCleaner.clean_backtrace(caller), + cached: data[:cached] ? 'cached' : '' + } + end end end end + +Peek::Views::ActiveRecord.prepend_if_ee('EE::Peek::Views::ActiveRecord') |