Skip to content

Add new method to aggregate usage service to use new usage table

What does this MR do and why?

In this MR, we add the logic to update the usage counters in resource and component tables while using the new usage table where we record the usage. Record component usages in the last_usage table (!171802 - merged) is the MR that added the usages to new table.

This change is behind a feature flag ci_catalog_ranking_from_new_usage_table, to derisk the deployment to .com.

Feature flag rollout issue - #505196 (closed)

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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

NA

How to set up and validate locally

  1. Follows the steps in !171802 (merged) to add some sample components and resources.
  2. Use them in sample project yaml to create some usage in the new table.
  3. Enable the feature flag - Feature.enable(:ci_catalog_ranking_from_new_usage_table)
  4. Run this Service to count and update the usage from rails console as follows:
response = Ci::Catalog::Resources::AggregateLast30DayUsageService.new.execute
puts response

Related to #495075 (closed)

Edited by Rajendra Kadam

Merge request reports

Loading