Migrations for Cycle Analytics backend
What does this MR do?
What is Cycle Analytics
- TLDR: Find all the
Issue
orMergeRequest
records matching with a date range query (start_event
andend_event
) =Stage
. - Calculate the duration (
end_event_time
-start_event_time
) - Extract the median duration
- Extract the list of records relevant to the date range
This change lays the foundation for customizable Cycle Analytics stages. The main reason for the change is to extract the event definitions to separate objects (start_event
, end_event
) so that it could be easily customized later on. (In EE we'd have about 20 new events)
This MR ensures that we have the right building blocks in place before implementing the customizable stages feature in EE and addresses some of the performance issues regarding to the feature.
To avoid having different implementation in CE and EE, the default cycle analytics stages that we provide (implemented as community contribution) are also implemented with the new structure.
Database Structure Notes
- Gitlab DB guidelines kinda advising against polymorphic associations (we also have a rubocop rule for it, https://docs.gitlab.com/ee/development/polymorphic_associations.html).
- Group and Project specific stage data will be never queried together.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry for user-facing changes, or community contribution. Check the link for other scenarios. -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team