Prevent new occurrences of Gitlab::InternalEvents being used without an internal event definition

Motivation

Some redis_hll-only events are triggered using Gitlab::InternalEvents. This can lead to mixed usage of event triggering APIs within a feature/file/or even events. This makes it hard for users to tell old events and new events apart, as well as leads to some messier cache keys.

As we want to migrate everything to internal events, we should prevent these inconsistencies from growing in volume.

Proposal

  1. In development, raise an error if an event is triggered that does not have a corresponding event definition including internal_events: true.
  2. In test, raise the same error unless the event is listed in lib/gitlab/usage_data_counters/hll_redis_legacy_events.yml.
  3. In production, continue to accept all events.

This should prevent scenarios like these: (events triggered as internal events but have either misconfigured or missing definitions)

  • app/controllers/projects/blob_controller.rb - g_edit_by_sfe
  • app/graphql/mutations/snippets/create.rb, app/graphql/mutations/snippets/update.rb - g_edit_by_snippet_ide
  • lib/api/commits.rb - g_edit_by_web_ide
  • ee/app/controllers/groups/analytics/cycle_analytics_controller.rb - view_cycle_analytics
  • ee/app/controllers/groups/analytics/productivity_analytics_controller.rb - view_productivity_analytics
  • app/services/ml/create_model_service.rb - model_registry_ml_model_created
  • ee/app/controllers/groups/analytics/dashboards_controller.rb - value_streams_dashboard_viewed
  • ee/app/controllers/projects/analytics/dashboards_controller.rb - analytics_dashboard_viewed
  • lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb - i_code_review_user_create_mr
Edited by Sarah Yasonik