Skip to content

Trigger record creation for code analytics on new commit

Adam Hegyi requested to merge 14699-persist-file-records-on-commit into master

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

Performance and Testing

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

Merge request reports