diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /lib/gitlab/usage_data_metrics.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
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 |