diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-20 12:22:56 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-20 12:22:56 +0200 |
commit | 5f2dc999bd5dbcf9707c7e5a89e2e18ec419bb2d (patch) | |
tree | a0c6381321f48c4abb6a385ce23040f6fbb6fe7e /lib | |
parent | ed5c7d11b19c9507206ada5c6e12eef477370fa9 (diff) | |
download | gitlab-ce-5f2dc999bd5dbcf9707c7e5a89e2e18ec419bb2d.tar.gz |
use proper `if defined?` check.33823_do_not_enable_defaults_when_metrics_folder_is_missing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/metrics/prometheus.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/metrics/prometheus.rb b/lib/gitlab/metrics/prometheus.rb index 25421c0a92f..9d314a56e58 100644 --- a/lib/gitlab/metrics/prometheus.rb +++ b/lib/gitlab/metrics/prometheus.rb @@ -6,12 +6,15 @@ module Gitlab include Gitlab::CurrentSettings def metrics_folder_present? - ENV.has_key?('prometheus_multiproc_dir') && ::Dir.exist?(ENV['prometheus_multiproc_dir']) && + ENV.has_key?('prometheus_multiproc_dir') && + ::Dir.exist?(ENV['prometheus_multiproc_dir']) && ::File.writable?(ENV['prometheus_multiproc_dir']) end def prometheus_metrics_enabled? - @prometheus_metrics_enabled ||= prometheus_metrics_enabled_unmemoized + return @prometheus_metrics_enabled if defined?(@prometheus_metrics_enabled) + + @prometheus_metrics_enabled = prometheus_metrics_enabled_unmemoized end def registry |