Commit 087c9a5e authored by Pawel Chojnacki's avatar Pawel Chojnacki

Fix rubocop warnings

parent 0325c237
......@@ -4,13 +4,13 @@ module Gitlab
extend ActiveSupport::Concern
included do
@@_metrics_provider_mutex ||= Mutex.new
@@_metrics_provider_cache ||= {}
@_metrics_provider_mutex ||= Mutex.new
@_metrics_provider_cache ||= {}
end
class_methods do
def reload_metric!(name)
@@_metrics_provider_cache.delete(name)
@_metrics_provider_cache.delete(name)
end
private
......@@ -22,7 +22,7 @@ module Gitlab
define_singleton_method(name) do
# avoid unnecessary method call to speed up metric access
return @@_metrics_provider_cache[name] if @@_metrics_provider_cache.has_key?(name)
return @_metrics_provider_cache[name] if @_metrics_provider_cache.has_key?(name)
fetch_metric(type, name, opts, &block)
end
......@@ -30,16 +30,16 @@ module Gitlab
def fetch_metric(type, name, opts = {}, &block)
# avoid synchronization to speed up metrics access
return @@_metrics_provider_cache[name] if @@_metrics_provider_cache.has_key?(name)
return @_metrics_provider_cache[name] if @_metrics_provider_cache.has_key?(name)
options = MetricOptions.new(opts)
options.evaluate(&block)
@@_metrics_provider_mutex.synchronize do
@@_metrics_provider_cache[name] ||= build_metric!(type, name, options)
@_metrics_provider_mutex.synchronize do
@_metrics_provider_cache[name] ||= build_metric!(type, name, options)
end
@@_metrics_provider_cache[name]
@_metrics_provider_cache[name]
end
def build_metric!(type, name, options)
......
......@@ -153,6 +153,7 @@ module Gitlab
fetch_metric(type, metric_name) do
docstring "Transaction #{prefix}#{name} #{type}"
base_labels tags.merge(BASE_LABELS)
if type == :gauge
multiprocess_mode :livesum
end
......
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