API updates to support new Vulnerability Trends line chart
Overview
Create new metrics widgets showing vulnerabilities by severity over time (see mocks)
- Default to showing Critical, High, and Medium vulnerability data series on; Low and Unknown are still available but user must click to toggle visibility
- Restrict maximum time scale to a reasonable length that prevents performance concerns. If no performance concerns, make unbounded or use first vulnerability's detected date. Otherwise, ideally we can do 1 year.
Documentation
https://docs.gitlab.com/ee/user/application_security/security_dashboard/#project-security-dashboard will be handled under the scope of the frontend issue. API documentation updates should be part of the scope of this issue.
Implementation Plan
-
database/backend fix problem described in #238456 (comment 398650151), -
database/backend expand date constraint beyond 100 days in Vulnerabilities::HistoricalStatistics::DeletionService
(https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/services/vulnerabilities/historical_statistics/deletion_service.rb#L12), -
backend Verify query generated by Resolvers::VulnerabilitiesCountPerDayResolver
and look for potential optimizations (if there are any needed) -
backend Add GraphQL API to Project to fetch Historical Statistics
Edited by Alan (Maciej) Paruszewski