diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 18:10:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 18:10:03 +0300 |
commit | c74c13e2e1f3287e98f2519b098180bb30d358af (patch) | |
tree | d410b27b793c04ed5e909edf555b99b65214c8f5 /lib/gitlab/usage_data_metrics.rb | |
parent | 63c306d96043ff012510358037c19053a2102e8a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/usage_data_metrics.rb')
-rw-r--r-- | lib/gitlab/usage_data_metrics.rb | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/lib/gitlab/usage_data_metrics.rb b/lib/gitlab/usage_data_metrics.rb index dde5dde19e0..1ef201121d9 100644 --- a/lib/gitlab/usage_data_metrics.rb +++ b/lib/gitlab/usage_data_metrics.rb @@ -5,26 +5,7 @@ module Gitlab class << self # Build the Usage Ping JSON payload from metrics YAML definitions which have instrumentation class set def uncached_data - ::Gitlab::Usage::MetricDefinition.all.map do |definition| - instrumentation_class = definition.attributes[:instrumentation_class] - options = definition.attributes[:options] - - if instrumentation_class.present? - metric_value = "Gitlab::Usage::Metrics::Instrumentations::#{instrumentation_class}".constantize.new( - time_frame: definition.attributes[:time_frame], - options: options).value - - metric_payload(definition.key_path, metric_value) - else - {} - end - end.reduce({}, :deep_merge) - end - - private - - def metric_payload(key_path, value) - ::Gitlab::Usage::Metrics::KeyPathProcessor.process(key_path, value) + ::Gitlab::Usage::Metric.all.map(&:with_value).reduce({}, :deep_merge) end end end |