Skip to content

Resolve "Code Review Analytics MVC - API Implementation"

Pavel Shutsin requested to merge 194161-code-review-analytics-api into master

What does this MR do?

Introduces API for Code Review Analytics

Database performance query plans

explain SELECT  merge_requests.* FROM merge_requests INNER JOIN merge_request_metrics ON merge_request_metrics.merge_request_id = merge_requests.id WHERE merge_requests.target_project_id = 278964 AND (merge_requests.state_id IN (1)) ORDER BY merge_request_metrics.first_comment_at ASC NULLS LAST LIMIT 20 OFFSET 0

  Limit  (cost=5251.58..5251.63 rows=20 width=731) (actual time=18.736..18.753 rows=20 loops=1)
   Buffers: shared hit=5395
   ->  Sort  (cost=5251.58..5253.50 rows=770 width=731) (actual time=18.734..18.745 rows=20 loops=1)
         Sort Key: merge_request_metrics.first_comment_at
         Sort Method: top-N heapsort  Memory: 59kB
         Buffers: shared hit=5395
         ->  Nested Loop  (cost=0.99..5231.09 rows=770 width=731) (actual time=0.073..17.729 rows=875 loops=1)
               Buffers: shared hit=5392
               ->  Index Scan using idx_merge_requests_on_target_project_id_and_iid_opened on public.merge_requests  (cost=0.43..1349.36 rows=847 width=723) (actual time=0.041..5.514 rows=875 loops=1)
                     Index Cond: (merge_requests.target_project_id = 278964)
                     Buffers: shared hit=1010
               ->  Index Scan using index_merge_request_metrics on public.merge_request_metrics  (cost=0.56..4.57 rows=1 width=12) (actual time=0.013..0.013 rows=1 loops=875)
                     Index Cond: (merge_request_metrics.merge_request_id = merge_requests.id)
                     Buffers: shared hit=4382

Time: 24.041 ms
  - planning: 5.136 ms
  - execution: 18.905 ms
    - I/O read: 0.000 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 5395 (~42.10 MiB) from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

Does this MR meet the acceptance criteria?

Conformity

Availability 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 #194161 (closed)

Edited by Pavel Shutsin

Merge request reports