diff options
Diffstat (limited to 'lib/gitlab/utils/usage_data.rb')
-rw-r--r-- | lib/gitlab/utils/usage_data.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/utils/usage_data.rb b/lib/gitlab/utils/usage_data.rb index d46210f6efe..77f04929661 100644 --- a/lib/gitlab/utils/usage_data.rb +++ b/lib/gitlab/utils/usage_data.rb @@ -43,11 +43,16 @@ module Gitlab HISTOGRAM_FALLBACK = { '-1' => -1 }.freeze DISTRIBUTED_HLL_FALLBACK = -2 MAX_BUCKET_SIZE = 100 + INSTRUMENTATION_CLASS_FALLBACK = -100 + + def add_metric(metric, time_frame: 'none', options: {}) + # Results of this method should be overwritten by instrumentation class values + # -100 indicates the metric was not properly merged. + return INSTRUMENTATION_CLASS_FALLBACK if Feature.enabled?(:usage_data_instrumentation) - def add_metric(metric, time_frame: 'none') metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize - metric_class.new(time_frame: time_frame).value + metric_class.new(time_frame: time_frame, options: options).value end def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil) |