diff options
Diffstat (limited to 'spec/support/shared_examples/config/metrics/every_metric_definition_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/config/metrics/every_metric_definition_shared_examples.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/spec/support/shared_examples/config/metrics/every_metric_definition_shared_examples.rb b/spec/support/shared_examples/config/metrics/every_metric_definition_shared_examples.rb index 14d0ac81250..53d80c64827 100644 --- a/spec/support/shared_examples/config/metrics/every_metric_definition_shared_examples.rb +++ b/spec/support/shared_examples/config/metrics/every_metric_definition_shared_examples.rb @@ -79,7 +79,7 @@ RSpec.shared_examples 'every metric definition' do end it 'is included in the Usage Ping hash structure' do - msg = "see https://docs.gitlab.com/ee/development/service_ping/metrics_dictionary.html#metrics-added-dynamic-to-service-ping-payload" + msg = "see https://docs.gitlab.com/ee/development/internal_analytics/metrics/metrics_dictionary.html#metrics-added-dynamic-to-service-ping-payload" expect(expected_metric_files_key_paths).to match_array(usage_ping_key_paths), msg end @@ -114,7 +114,8 @@ RSpec.shared_examples 'every metric definition' do Gitlab::Usage::Metrics::Instrumentations::RedisMetric, Gitlab::Usage::Metrics::Instrumentations::RedisHLLMetric, Gitlab::Usage::Metrics::Instrumentations::NumbersMetric, - Gitlab::Usage::Metrics::Instrumentations::PrometheusMetric + Gitlab::Usage::Metrics::Instrumentations::PrometheusMetric, + Gitlab::Usage::Metrics::Instrumentations::TotalCountMetric ] end @@ -125,10 +126,23 @@ RSpec.shared_examples 'every metric definition' do ].freeze end + let(:removed_classes) do + [ + Gitlab::Usage::Metrics::Instrumentations::InProductMarketingEmailCtaClickedMetric, + Gitlab::Usage::Metrics::Instrumentations::InProductMarketingEmailSentMetric + ].freeze + end + + def metric_not_used?(constant) + parent_metric_classes.include?(constant) || + ignored_classes.include?(constant) || + removed_classes.include?(constant) + end + def assert_uses_all_nested_classes(parent_module) parent_module.constants(false).each do |const_name| constant = parent_module.const_get(const_name, false) - next if parent_metric_classes.include?(constant) || ignored_classes.include?(constant) + next if metric_not_used?(constant) case constant when Class |