Migrate symbol package metrics to internal events
What does this MR do and why?
Related to #424893 (closed)
This is the last stage of migrating package events, started with pull events migration.
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.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
- On
masterbranch, in the ruby console, trigger all the migrated events:%w[i_package_nuget_pull_symbol_package i_package_nuget_push_symbol_package i_package_pull_symbol_package i_package_pull_symbol_package_by_deploy_token i_package_pull_symbol_package_by_guest i_package_pull_symbol_package_by_user i_package_push_symbol_package i_package_push_symbol_package_by_deploy_token i_package_push_symbol_package_by_guest i_package_push_symbol_package_by_user].each {|ev| ::Gitlab::UsageDataCounters::PackageEventCounter.count(ev)} - Calculate the metrics values:
metrics = %w[counts.package_events_i_package_nuget_pull_symbol_package counts.package_events_i_package_nuget_push_symbol_package counts.package_events_i_package_pull_symbol_package counts.package_events_i_package_pull_symbol_package_by_deploy_token counts.package_events_i_package_pull_symbol_package_by_guest counts.package_events_i_package_pull_symbol_package_by_user counts.package_events_i_package_push_symbol_package counts.package_events_i_package_push_symbol_package_by_deploy_token counts.package_events_i_package_push_symbol_package_by_guest counts.package_events_i_package_push_symbol_package_by_user]; sp = Gitlab::Usage::ServicePing::InstrumentedPayload.new(metrics, :with_value).build - Check out this MR's branch and
reload!the console - Make sure that all the metrics have the same values:
sp2 = Gitlab::Usage::ServicePing::InstrumentedPayload.new(metrics, :with_value).buildand then verify thatsp == sp2returnstrue - Trigger all of the events again:
%w[push_symbol_package_to_registry pull_symbol_package_from_registry].each {|e| %w[deploy_token guest user].each {|p| Gitlab::InternalEvents.track_event(e, additional_properties: { label: 'nuget', property: p })}} - Generate new metric values
sp3 = Gitlab::Usage::ServicePing::InstrumentedPayload.new(metrics, :with_value).build - Make sure that all the metrics values have increased:
sp3.values.first.map {|k, v| v > sp2[:counts][k]}.uniqshould return[true]
Edited by Michał Wielich