Use `events` over `options` for internal events
What does this MR do and why?
Related to #427298 (closed)
All internal events metrics currently repeat the same data in options
and events
attribute. As a first step towards removing options
, let's make it so that the metrics classes read the events
attribute instead of the options
attribute when possible.
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
- Stay on
master
branch - Choose an internal_events metric with
events:
key, for example: g_project_management_issue_removed_from_epic_monthly - Trigger the event tracked by the metric for last week, for example:
Gitlab::UsageDataCounters::HLLRedisCounter.track_event('g_project_management_issue_removed_from_epic', values: SecureRandom.uuid, property_name: 'user.id', time: 1.week.ago)
. You can repeat that multiple times. - Open the rails console and try to calculate the chosen metric, for example:
Gitlab::Usage::ServicePing::InstrumentedPayload.new(['redis_hll_counters.issues_edit.g_project_management_issue_removed_from_epic_monthly'], :with_value).build
. Since we triggered the event, this should return a non-zero value. - Checkout this MR's branch and
reload!
the console - Calculate the metric again:
Gitlab::Usage::ServicePing::InstrumentedPayload.new(['redis_hll_counters.issues_edit.g_project_management_issue_removed_from_epic_monthly'], :with_value).build
- This should return the same value as before.
- Remove the
options
block from the metric (example: lines 12-14) andreload!
the console again - Calculate the metric again. This should return the same value again.
Edited by Michał Wielich