Commit 99881bb7 authored by Pawel Chojnacki's avatar Pawel Chojnacki

Move labels to be initialized in constructor

parent 77e938a8
......@@ -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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment