diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-01-16 20:03:30 +0100 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-01-29 15:13:03 +0100 |
commit | 66c2a3a83e2c8a15302213141923723295d0d647 (patch) | |
tree | 7201fd6d4249792cfd4aab543d13d207c789e67c /lib/gitlab/metrics | |
parent | 5328584b1eb8209145685725e2948b4f51a58059 (diff) | |
download | gitlab-ce-66c2a3a83e2c8a15302213141923723295d0d647.tar.gz |
Fix helper methods and document metric builder options
Diffstat (limited to 'lib/gitlab/metrics')
-rw-r--r-- | lib/gitlab/metrics/concern.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/metrics/concern/metric_options.rb | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/gitlab/metrics/concern.rb b/lib/gitlab/metrics/concern.rb index e7c91df94bc..5d465232726 100644 --- a/lib/gitlab/metrics/concern.rb +++ b/lib/gitlab/metrics/concern.rb @@ -65,28 +65,28 @@ module Gitlab # @param [Symbol] name # @param [Hash] opts def fetch_counter(name, opts = {}, &block) - define_metric(:counter, name, opts, &block) + fetch_metric(:counter, name, opts, &block) end # DFetch and/or initialize gauge metric # @param [Symbol] name # @param [Hash] opts def fetch_gauge(name, opts = {}, &block) - define_metric(:counter, name, opts, &block) + fetch_metric(:counter, name, opts, &block) end # Fetch and/or initialize histogram metric # @param [Symbol] name # @param [Hash] opts def fetch_histogram(name, opts = {}, &block) - define_metric(:histogram, name, opts, &block) + fetch_metric(:histogram, name, opts, &block) end # Fetch and/or initialize summary metric # @param [Symbol] name # @param [Hash] opts def fetch_summary(name, opts = {}, &block) - define_metric(:summary, name, opts, &block) + fetch_metric(:summary, name, opts, &block) end # Define metric accessor method for a Counter diff --git a/lib/gitlab/metrics/concern/metric_options.rb b/lib/gitlab/metrics/concern/metric_options.rb index 996757e11d5..dc964512912 100644 --- a/lib/gitlab/metrics/concern/metric_options.rb +++ b/lib/gitlab/metrics/concern/metric_options.rb @@ -10,30 +10,39 @@ module Gitlab @with_feature = options[:with_feature] end + # Documentation describing metric in metrics endpoint '/-/metrics' def docstring(docstring = nil) @docstring = docstring unless docstring.nil? @docstring end + # Gauge aggregation mode for multiprocess metrics + # - :all (default) returns each gauge for every process + # - :livesum all process'es gauges summed up + # - :max maximum value of per process gauges + # - :min minimum value of per process gauges def multiprocess_mode(mode = nil) @multiprocess_mode = mode unless mode.nil? @multiprocess_mode end + # Measurement buckets for histograms def buckets(buckets = nil) @buckets = buckets unless buckets.nil? @buckets end + # Base labels are merged with per metric labels def base_labels(base_labels = nil) @base_labels = base_labels unless base_labels.nil? @base_labels end + # Use feature toggle to control whether certain metric is enabled/disabled def with_feature(name = nil) @feature_name = name unless name.nil? |