summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-01-06 16:41:55 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2016-01-06 16:41:55 +0000
commitbcd2a09da72d430773b4b4bbc700132aade641d7 (patch)
treea5e89cbcd1a841e5fadaf778e828fc94862da68c /lib
parentfc386b65d090848322b70ca915d9140482a51494 (diff)
parent7549102bb727daecc51da84af39956b32fc41537 (diff)
downloadgitlab-ce-bcd2a09da72d430773b4b4bbc700132aade641d7.tar.gz
Merge branch 'metrics-milliseconds' into 'master'
See merge request !2316
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/metrics/subscribers/action_view.rb8
-rw-r--r--lib/gitlab/metrics/subscribers/active_record.rb6
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/gitlab/metrics/subscribers/action_view.rb b/lib/gitlab/metrics/subscribers/action_view.rb
index 7c0105d543a..84d9e383625 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, event.duration)
+ current_transaction.increment(:view_duration, duration(event))
current_transaction.add_metric(SERIES, values, tags)
end
@@ -28,7 +28,7 @@ module Gitlab
end
def values_for(event)
- { duration: event.duration }
+ { duration: duration(event) }
end
def tags_for(event)
@@ -48,6 +48,10 @@ 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 8008b3bc895..6fa73e7a3be 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, event.duration)
+ current_transaction.increment(:sql_duration, duration(event))
end
private
@@ -16,6 +16,10 @@ module Gitlab
def current_transaction
Transaction.current
end
+
+ def duration(event)
+ event.duration * 1000.0
+ end
end
end
end