Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-05-29 15:19:43 +0300
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-02 20:45:58 +0300
commitc134a72cdb7e6de8b70dc60de99cf4edc68a9227 (patch)
tree0082ba4d422cc53eea223583bca9c98cbc823c96 /lib/gitlab/metrics
parent770f07cd5c68075bb261f4b6139c92b2ac9309c0 (diff)
Move Prometheus presentation logic to PrometheusText
+ Use NullMetrics to mock metrics when unused + Use method_missing in NullMetrics mocking + Update prometheus gem to version that correctly uses transitive dependencies + Ensure correct folders are used in Multiprocess prometheus client tests. + rename Sessions controller's metric
Diffstat (limited to 'lib/gitlab/metrics')
-rw-r--r--lib/gitlab/metrics/null_metric.rb (renamed from lib/gitlab/metrics/dummy_metric.rb)22
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/gitlab/metrics/dummy_metric.rb b/lib/gitlab/metrics/null_metric.rb
index d27bb83854a..1501cd38676 100644
--- a/lib/gitlab/metrics/dummy_metric.rb
+++ b/lib/gitlab/metrics/null_metric.rb
@@ -1,7 +1,12 @@
module Gitlab
module Metrics
# Mocks ::Prometheus::Client::Metric and all derived metrics
- class DummyMetric
+ class NullMetric
+ def method_missing(name, *args, &block)
+ nil
+ end
+
+ # these methods shouldn't be called when metrics are disabled
def get(*args)
raise NotImplementedError
end
@@ -9,21 +14,6 @@ module Gitlab
def values(*args)
raise NotImplementedError
end
-
- # counter
- def increment(*args)
- # noop
- end
-
- # gauge
- def set(*args)
- # noop
- end
-
- # histogram / summary
- def observe(*args)
- # noop
- end
end
end
end