diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-10-16 15:18:59 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-11-02 18:11:44 +0100 |
commit | 99881bb7b035429c689055c396897e8e04d31af1 (patch) | |
tree | 91fd4e66cf56a8e738747b9f64e49e450f71adb8 /lib/gitlab/metrics/method_call.rb | |
parent | 77e938a8f9335145e28b4d51c4ac4887121a2cf0 (diff) | |
download | gitlab-ce-99881bb7b035429c689055c396897e8e04d31af1.tar.gz |
Move labels to be initialized in constructor
Diffstat (limited to 'lib/gitlab/metrics/method_call.rb')
-rw-r--r-- | lib/gitlab/metrics/method_call.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/gitlab/metrics/method_call.rb b/lib/gitlab/metrics/method_call.rb index 2a962a82517..1d9cef7a6e8 100644 --- a/lib/gitlab/metrics/method_call.rb +++ b/lib/gitlab/metrics/method_call.rb @@ -3,7 +3,7 @@ module Gitlab # Class for tracking timing information about method calls class MethodCall BASE_LABELS = { module: nil, method: nil }.freeze - attr_reader :real_time, :cpu_time, :call_count + attr_reader :real_time, :cpu_time, :call_count, :labels def self.call_real_duration_histogram @call_real_duration_histogram ||= Gitlab::Metrics.histogram( @@ -31,6 +31,7 @@ module Gitlab @method_name = method_name @transaction = transaction @name = name + @labels = { module: @module_name, method: @method_name } @real_time = 0 @cpu_time = 0 @call_count = 0 @@ -55,10 +56,6 @@ module Gitlab retval end - def labels - @labels ||= { module: @module_name, method: @method_name } - end - # Returns a Metric instance of the current method call. def to_metric Metric.new( |