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