diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-12-11 23:52:28 +0100 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-12-12 18:38:28 +0100 |
commit | ca176a9bfe2ce9555da16e134bb92779b85952ad (patch) | |
tree | 29d00d4edd3a663f8497afb3af2230c8561d41ac /lib | |
parent | 408208bc2b75d28235092e9bb3821242fdad08fb (diff) | |
download | gitlab-ce-ca176a9bfe2ce9555da16e134bb92779b85952ad.tar.gz |
move call_measurement_enabled? method to the bottom of the file
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/metrics/method_call.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/gitlab/metrics/method_call.rb b/lib/gitlab/metrics/method_call.rb index 2c1cb789314..a6900225a27 100644 --- a/lib/gitlab/metrics/method_call.rb +++ b/lib/gitlab/metrics/method_call.rb @@ -20,17 +20,6 @@ module Gitlab end end - def call_measurement_enabled? - expires_at = MEASUREMENT_ENABLED_CACHE_EXPIRES_AT.value - if expires_at < Time.now.to_i - if MEASUREMENT_ENABLED_CACHE_EXPIRES_AT.compare_and_set(expires_at, (Time.now + 30.seconds).to_i) - MEASUREMENT_ENABLED_CACHE.value = Feature.get(:prometheus_metrics_method_instrumentation).enabled? - end - end - - MEASUREMENT_ENABLED_CACHE.value - end - # name - The full name of the method (including namespace) such as # `User#sign_in`. # @@ -83,6 +72,17 @@ module Gitlab def above_threshold? real_time >= Metrics.method_call_threshold end + + def call_measurement_enabled? + expires_at = MEASUREMENT_ENABLED_CACHE_EXPIRES_AT.value + if expires_at < Time.now.to_i + if MEASUREMENT_ENABLED_CACHE_EXPIRES_AT.compare_and_set(expires_at, (Time.now + 30.seconds).to_i) + MEASUREMENT_ENABLED_CACHE.value = Feature.get(:prometheus_metrics_method_instrumentation).enabled? + end + end + + MEASUREMENT_ENABLED_CACHE.value + end end end end |