diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /lib/gitlab/usage_data_queries.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'lib/gitlab/usage_data_queries.rb')
-rw-r--r-- | lib/gitlab/usage_data_queries.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/gitlab/usage_data_queries.rb b/lib/gitlab/usage_data_queries.rb index f64da2fbf13..f543b29e43f 100644 --- a/lib/gitlab/usage_data_queries.rb +++ b/lib/gitlab/usage_data_queries.rb @@ -6,13 +6,16 @@ module Gitlab class UsageDataQueries < UsageData class << self def uncached_data - super.with_indifferent_access.deep_merge(instrumentation_metrics_queries.with_indifferent_access) + # instrumentation_metrics is already included with feature flag enabled + return super if Feature.enabled?(:usage_data_instrumentation) + + super.with_indifferent_access.deep_merge(instrumentation_metrics.with_indifferent_access) end - def add_metric(metric, time_frame: 'none') + def add_metric(metric, time_frame: 'none', options: {}) metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize - metric_class.new(time_frame: time_frame).instrumentation + metric_class.new(time_frame: time_frame, options: options).instrumentation end def count(relation, column = nil, *args, **kwargs) @@ -71,7 +74,7 @@ module Gitlab private - def instrumentation_metrics_queries + def instrumentation_metrics ::Gitlab::Usage::Metric.all.map(&:with_instrumentation).reduce({}, :deep_merge) end end |