Skip to content

Unify InternalEvents and AggregatedMetric unique attribute format

Michał Wielich requested to merge michold-unify-aggregate into master

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

  1. Stay on master branch
  2. Choose an AggregatedMetric (eg. analytics_unique_visits_for_any_target_monthly)
  3. 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)
  4. Check out this MR's branch and reload! the rails console
  5. 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.
  6. 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))
  7. 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

Merge request reports