Unify InternalEvents and AggregatedMetric unique attribute format
What does this MR do and why?
Related to #439609 (closed)
We want InternalEvents and AggregatedMetric to same the same format, so that we can get rid of the mapping in AggregatedMetric class. The easiest way to achieve that should be by changing AggregatedMetric's user_id
notation into user.id
.
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
AggregatedMetric
(eg. analytics_unique_visits_for_any_target_monthly) - Count chosen metric's value using the metric's
key_path
attribute (eg.Gitlab::Usage::ServicePing::InstrumentedPayload.new(['analytics_unique_visits.analytics_unique_visits_for_any_target_monthly'], :with_value).build
) - Check out this MR's branch and
reload!
the rails console - Recalculate the metric (eg.
Gitlab::Usage::ServicePing::InstrumentedPayload.new(['analytics_unique_visits.analytics_unique_visits_for_any_target_monthly'], :with_value).build
). This should return the same value as before. - Trigger one of the chosen metric's events for last week (eg.
Gitlab::UsageDataCounters::HLLRedisCounter.track_event('i_analytics_dev_ops_adoption', values: SecureRandom.uuid, property_name: 'user', time: 1.week.ago)
) - Recalculate the metric (eg.
Gitlab::Usage::ServicePing::InstrumentedPayload.new(['analytics_unique_visits.analytics_unique_visits_for_any_target_monthly'], :with_value).build
). Its value should be increased by one.
Edited by Michał Wielich