Trigger record creation for code analytics on new commit
What does this MR do?
Issue: #33177
Task: for premium customers, keep track of the files (from the associated repo) in the DB (as commits happen) and expose the top N files that have been changed frequently for a given date range.
We use two tables (already merged):
-
analytics_repository_files
- keeps track of the files (full path) for a repository (project) -
analytics_repository_file_commits
- how many times was a file committed for the given date (not timestamp since we use date pickers)
The query part is already under review. This MR focuses on the data insertion. For that, I'm using standard INSERT INTO
statements with ON CONFLICT
clause.
This is the first iteration, I tried to keep as simple as possible. Known limitations:
- Force push is not handled.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
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
Closes #14699
Edited by Adam Hegyi