Commit b1ba8eb9 authored by Pawel Chojnacki's avatar Pawel Chojnacki

Do not use include Gitlab::CurrentSettings unnecessarily

parent 1ac96603
......@@ -13,8 +13,6 @@ module Gitlab
private_constant :MUTEX
class_methods do
include Gitlab::CurrentSettings
def influx_metrics_enabled?
settings[:enabled] || false
end
......@@ -22,17 +20,21 @@ module Gitlab
# Prometheus histogram buckets used for arbitrary code measurements
def settings
@settings ||= {
enabled: current_application_settings[:metrics_enabled],
pool_size: current_application_settings[:metrics_pool_size],
timeout: current_application_settings[:metrics_timeout],
method_call_threshold: current_application_settings[:metrics_method_call_threshold],
host: current_application_settings[:metrics_host],
port: current_application_settings[:metrics_port],
sample_interval: current_application_settings[:metrics_sample_interval] || 15,
packet_size: current_application_settings[:metrics_packet_size] || 1
@settings ||= begin
current_settings = Gitlab::CurrentSettings.current_application_settings
{
enabled: current_settings[:metrics_enabled],
pool_size: current_settings[:metrics_pool_size],
timeout: current_settings[:metrics_timeout],
method_call_threshold: current_settings[:metrics_method_call_threshold],
host: current_settings[:metrics_host],
port: current_settings[:metrics_port],
sample_interval: current_settings[:metrics_sample_interval] || 15,
packet_size: current_settings[:metrics_packet_size] || 1
}
end
end
def mri?
RUBY_ENGINE == 'ruby'
......
......@@ -9,7 +9,6 @@ module Gitlab
PROVIDER_MUTEX = Mutex.new
class_methods do
include Gitlab::CurrentSettings
include Gitlab::Utils::StrongMemoize
def metrics_folder_present?
......@@ -72,7 +71,8 @@ module Gitlab
end
def prometheus_metrics_enabled_unmemoized
metrics_folder_present? && current_application_settings[:prometheus_metrics_enabled] || false
metrics_folder_present? &&
Gitlab::CurrentSettings.current_application_settings[:prometheus_metrics_enabled] || false
end
end
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