Skip to content

Convert Redis metrics for package to Internal Events - pull events

What does this MR do and why?

Migrates all pull_package-metrics to use Internal Events instead.

A new event (pull_package_from_registry) is defined and all the pull metrics are migrated to use that event.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

To test this, we will create a generic package, then pull it and verify that all relevant metrics gets updated.

  1. Create a file echo "abc" > /tmp/foo.txt
  2. Create a generic package
    curl --header "PRIVATE-TOKEN: <TOKEN>" --upload-file /tmp/foo.txt \
      "http://gdk.test:3000/api/v4/projects/<project_id>/packages/generic/my_package/0.0.1/file.txt"
  3. Start the monitor by running: rails runner scripts/internal_events/monitor.rb pull_package_from_registry
  4. Pull the package
    curl --header "PRIVATE-TOKEN: <TOKEN>" \
       "http://gdk.test:3000/api/v4/projects/<proect_id>/packages/generic/my_package/0.0.1/file.txt"
  5. Use the monitor to see that all relevant metrics were updated. In this case it is counts.package_events_i_package_generic_pull_package, counts.package_events_i_package_pull_package and counts.package_events_i_package_pull_package_by_user
  6. Verify that the generated Snowplow event looks correct in the monitor

Related to #424893

Edited by Jonas Larsen

Merge request reports