summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-12-19 19:40:43 +0100
committerPawel Chojnacki <pawel@chojnacki.ws>2017-12-20 17:49:43 +0100
commited715b7926c31fddb1c835823d509672663e23e6 (patch)
tree0feb93b84820bd8b6ce25581d9b87701fe6c2fdb /lib
parent3c545133e8f23b57698046bae8be23e2bc457aca (diff)
downloadgitlab-ce-ed715b7926c31fddb1c835823d509672663e23e6.tar.gz
use in_milliseconds rails helper
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/metrics/method_call.rb4
-rw-r--r--lib/gitlab/metrics/transaction.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/metrics/method_call.rb b/lib/gitlab/metrics/method_call.rb
index a030092df37..bb39b1d5462 100644
--- a/lib/gitlab/metrics/method_call.rb
+++ b/lib/gitlab/metrics/method_call.rb
@@ -27,7 +27,7 @@ module Gitlab
@transaction = transaction
@name = name
@labels = { module: @module_name, method: @method_name }
- @real_time_seconds = 0
+ @real_time_seconds = 0.0
@cpu_time = 0
@call_count = 0
end
@@ -53,7 +53,7 @@ module Gitlab
end
def real_time_milliseconds
- (real_time_seconds * 1000.0).to_i
+ real_time_seconds.in_milliseconds.to_i
end
# Returns a Metric instance of the current method call.
diff --git a/lib/gitlab/metrics/transaction.rb b/lib/gitlab/metrics/transaction.rb
index 16f0969ab74..e7975c023a9 100644
--- a/lib/gitlab/metrics/transaction.rb
+++ b/lib/gitlab/metrics/transaction.rb
@@ -36,7 +36,7 @@ module Gitlab
end
def duration_milliseconds
- (duration * 1000).to_i
+ duration.in_milliseconds.to_i
end
def allocated_memory