diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-01-07 13:47:06 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-01-07 13:47:06 +0300 |
commit | 7ed3a5a240e4997b24d11b96e27126dfaa575abe (patch) | |
tree | 3e818411df08c081eb07eab80c3d53386ddbe178 /lib/gitlab/metrics/subscribers | |
parent | 0deeebc175d5b970cb53f8fc455a4b8faf5f5d2d (diff) |
Revert "Store SQL/view timings in milliseconds"
This reverts commit 7549102bb727daecc51da84af39956b32fc41537.
Apparently I was wrong about
ActiveSupport::Notifications::Event#duration returning the duration in
seconds, instead it returns it in milliseconds already.
Diffstat (limited to 'lib/gitlab/metrics/subscribers')
-rw-r--r-- | lib/gitlab/metrics/subscribers/action_view.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/metrics/subscribers/active_record.rb | 6 |
2 files changed, 3 insertions, 11 deletions
diff --git a/lib/gitlab/metrics/subscribers/action_view.rb b/lib/gitlab/metrics/subscribers/action_view.rb index 84d9e383625..7c0105d543a 100644 --- a/lib/gitlab/metrics/subscribers/action_view.rb +++ b/lib/gitlab/metrics/subscribers/action_view.rb @@ -19,7 +19,7 @@ module Gitlab values = values_for(event) tags = tags_for(event) - current_transaction.increment(:view_duration, duration(event)) + current_transaction.increment(:view_duration, event.duration) current_transaction.add_metric(SERIES, values, tags) end @@ -28,7 +28,7 @@ module Gitlab end def values_for(event) - { duration: duration(event) } + { duration: event.duration } end def tags_for(event) @@ -48,10 +48,6 @@ module Gitlab def current_transaction Transaction.current end - - def duration(event) - event.duration * 1000.0 - end end end end diff --git a/lib/gitlab/metrics/subscribers/active_record.rb b/lib/gitlab/metrics/subscribers/active_record.rb index 6fa73e7a3be..8008b3bc895 100644 --- a/lib/gitlab/metrics/subscribers/active_record.rb +++ b/lib/gitlab/metrics/subscribers/active_record.rb @@ -8,7 +8,7 @@ module Gitlab def sql(event) return unless current_transaction - current_transaction.increment(:sql_duration, duration(event)) + current_transaction.increment(:sql_duration, event.duration) end private @@ -16,10 +16,6 @@ module Gitlab def current_transaction Transaction.current end - - def duration(event) - event.duration * 1000.0 - end end end end |