Migrate container registry tracking to internal event tracking

Problem

In this issue, we want to migrate our existing tracking in Container Registry from Snowplow and Redis/RedisHLL as they are now deprecated and will be replaced by Internal Events Tracking.

Here is the migration guide: https://docs.gitlab.com/ee/development/internal_analytics/internal_event_instrumentation/migration.html

From the migration guide:

Tracking events directly via Snowplow, Redis/RedisHLL is deprecated but won’t be removed in the foreseeable future. While we encourage you to migrate to Internal Event tracking the deprecated methods will continue to work for existing events and metrics.

Note that our current tracking still works and there is no date yet as to when they will remove it. But it might be good to migrate when we can to not use a deprecated system.

Here are our current metrics:

  • create_repository_deploy_token
  • create_repository_user
  • delete_repository_deploy_token
  • delete_repository_user
  • delete_tag_deploy_token
  • delete_tag_user
  • push_repository_deploy_token
  • push_repository_user
  • push_tag_deploy_token
  • push_tag_user
  • delete_manifest
  • writes_user

Note: We want to migrate weekly & monthly metrics for all of these.

Desired Outcome

The above metrics are migrated to internal events

Proposed solution

Migrate the existing code in https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/container_registry/event.rb#L42 over to call internal events.

It should be possible to make sure events still end up with the same Snowplow actions as being tracked in this line to preserve the continuity of events.

Follow up actions

Edited by Michał Wielich