Skip to content

Record error rate on security scan reports

Gregorius Marco requested to merge mg-security-scan-application-sli into master

What does this MR do and why?

This MR adds the following:

  • Gitlab::Metrics::SecurityScanSlis - an application SLI which provides the error rate metrics
  • Increment the metrics in Security::StoreGroupedScansService after security scan reports are parsed and stored.

After security scans are finished in CI, the report ingestion starts by the Security::StoreScansWorker which eventually calls Security::StoreGroupedScansService. The latter service parses the reports and stores in DB. More information https://docs.gitlab.com/ee/development/sec/security_report_ingestion_overview.html#scan-runs-in-a-pipeline-for-a-non-default-branch.

Here, we emit the error rate metrics based on the scan reports status. This will give us better observability on the security scanners performance.

Note that currently scan reports always have "status": "success" because crashed scan jobs don't produce any report. This will be resolved in #241342. Once reports are generated on job failure too, the metrics will automatically emit an error too.

References

Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

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

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Gregorius Marco

Merge request reports

Loading