diff options
Diffstat (limited to 'lib/gitlab/utils')
-rw-r--r-- | lib/gitlab/utils/usage_data.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gitlab/utils/usage_data.rb b/lib/gitlab/utils/usage_data.rb index faa524d171c..d46210f6efe 100644 --- a/lib/gitlab/utils/usage_data.rb +++ b/lib/gitlab/utils/usage_data.rb @@ -44,6 +44,12 @@ module Gitlab DISTRIBUTED_HLL_FALLBACK = -2 MAX_BUCKET_SIZE = 100 + def add_metric(metric, time_frame: 'none') + metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize + + metric_class.new(time_frame: time_frame).value + end + def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil) if batch Gitlab::Database::BatchCount.batch_count(relation, column, batch_size: batch_size, start: start, finish: finish) |