Add DB metric for external audit streams

What does this MR do and why?

Add DB metric for external audit streams where groups are actively using compliance frameworks (at least one project has one assigned)

References

Database Timings

https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37230/commands/114090

-- groups with frameworks on projects and streaming destinations

SELECT COUNT("audit_events_external_audit_event_destinations"."id")
FROM "audit_events_external_audit_event_destinations"
WHERE "audit_events_external_audit_event_destinations"."namespace_id" IN
    (SELECT DISTINCT "namespaces"."id"
     FROM "namespaces"
     JOIN projects ON projects.namespace_id = namespaces.id
     JOIN project_compliance_framework_settings ON project_compliance_framework_settings.project_id = projects.id
     WHERE "namespaces"."type" = 'Group'
       AND "project_compliance_framework_settings"."framework_id" IS NOT NULL)
Time: 2.143 s
  - planning: 143.834 ms
  - execution: 1.999 s
    - I/O read: 3.291 s
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 1643638 (~12.50 GiB) from the buffer pool
  - reads: 199381 (~1.50 GiB) from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by SAM FIGUEROA

Merge request reports

Loading