Skip to content

Add metrics for users creating MRs with applied scan result policies

What does this MR do and why?

This MR adds metrics to count The total number of users who have created merge requests with at least one applicable scan result policy.

Queries

explain SELECT COUNT(DISTINCT "merge_requests"."author_id") FROM "merge_requests"
INNER JOIN "approval_merge_request_rules" ON "approval_merge_request_rules"."merge_request_id" = "merge_requests"."id"
WHERE "approval_merge_request_rules"."report_type" = 4 AND
"merge_requests"."author_id" BETWEEN 5525431 AND 5535431;

Before

Time: 2.809 min
  - planning: 6.236 ms
  - execution: 2.808 min
    - I/O read: 8.265 min
    - I/O write: 0.182 ms

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/12551/commands/44301

After (with additional index from !99958 (merged))

Time: 7.727 s
  - planning: 7.284 ms
  - execution: 7.720 s
    - I/O read: 7.220 s
    - I/O write: 0.000 ms

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/12551/commands/44310

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #375284 (closed)

Edited by Alan (Maciej) Paruszewski

Merge request reports

Loading