提交 99881bb7 编写于 作者: P Pawel Chojnacki

Move labels to be initialized in constructor

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册