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 | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'lib/gitlab/usage')
-rw-r--r-- | lib/gitlab/usage/metric.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/usage/metrics/names_suggestions/generator.rb | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/usage/metric.rb b/lib/gitlab/usage/metric.rb index 5b1ac189c13..24e044c5740 100644 --- a/lib/gitlab/usage/metric.rb +++ b/lib/gitlab/usage/metric.rb @@ -25,6 +25,10 @@ module Gitlab unflatten_key_path(intrumentation_object.instrumentation) end + def with_suggested_name + unflatten_key_path(intrumentation_object.suggested_name) + end + private def unflatten_key_path(value) diff --git a/lib/gitlab/usage/metrics/names_suggestions/generator.rb b/lib/gitlab/usage/metrics/names_suggestions/generator.rb index b47dc5689d4..6dcbe5f5fe5 100644 --- a/lib/gitlab/usage/metrics/names_suggestions/generator.rb +++ b/lib/gitlab/usage/metrics/names_suggestions/generator.rb @@ -10,14 +10,18 @@ module Gitlab uncached_data.deep_stringify_keys.dig(*key_path.split('.')) 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).suggested_name + metric_class.new(time_frame: time_frame, options: options).suggested_name end private + def instrumentation_metrics + ::Gitlab::UsageDataMetrics.suggested_names + end + def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil) Gitlab::Usage::Metrics::NameSuggestion.for(:count, column: column, relation: relation) end |