Class: Gitlab::Metrics::Subscribers::ActiveRecord

Inherits:
ActiveSupport::Subscriber
  • Object
show all
Defined in:
lib/gitlab/metrics/subscribers/active_record.rb

Overview

Class for tracking the total query duration of a transaction.

Instance Method Summary collapse

Instance Method Details

#sql(event) ⇒ Object


8
9
10
11
12
13
# File 'lib/gitlab/metrics/subscribers/active_record.rb', line 8

def sql(event)
  return unless current_transaction

  current_transaction.increment(:sql_duration, event.duration)
  current_transaction.increment(:sql_count, 1)
end