blob: 8008b3bc8953631851f193f946fa6f1d62b39133 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module Gitlab
module Metrics
module Subscribers
# Class for tracking the total query duration of a transaction.
class ActiveRecord < ActiveSupport::Subscriber
attach_to :active_record
def sql(event)
return unless current_transaction
current_transaction.increment(:sql_duration, event.duration)
end
private
def current_transaction
Transaction.current
end
end
end
end
end
|