Skip to content

Add metrics for merge requests with applied scan result policies

What does this MR do and why?

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

Queries

SELECT COUNT(DISTINCT "approval_merge_request_rules"."merge_request_id") FROM "approval_merge_request_rules"
WHERE "approval_merge_request_rules"."report_type" = 4 AND
"approval_merge_request_rules"."merge_request_id" BETWEEN 5525431 AND 5535431;

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/12479/commands/44107

Time: 118.399 ms
  - planning: 1.301 ms
  - execution: 117.098 ms
    - I/O read: 116.349 ms
    - I/O write: 0.000 ms

After creating the index:

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/12479/commands/44142

Time: 1.823 ms
  - planning: 1.649 ms
  - execution: 0.174 ms
    - I/O read: 0.000 ms
    - I/O write: 0.000 ms

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