Add mttrOverTime field to securityMetrics

What does this MR do and why?

  • Adds the mttrOverTime field to SecurityMetrics (group, project and organization) for the security dashboard's "MTTR over time" chart.
  • Returns one bucket per Monday–Sunday week from MttrOverTimeFinder, as a plain list matching the agreed contract. Every week, severity and report type is zero-filled.
  • Behind the security_dashboard_mttr_chart feature flag. It returns null when the flag is off, and the rest of securityMetrics is unaffected. Marked as an experiment (19.5).
  • bySeverity and byReportType are only computed when selected. It is always a single Elasticsearch query.
  • The date range is validated: start on or before end, start not in the future, and at most 12 weeks (MTTR_OVER_TIME_MAX_WEEKS).
  • Removes the security dashboard's client-side typedefs.graphql. It declared the same field and types, which now clash with the real schema. The mock resolvers stay until the frontend switches to the API in !255843 (merged).

References

Screenshots or screen recordings

No UI changes. Validated end to end in a GDK together with the frontend MR (!255843 (merged)).

How to set up and validate locally

  1. Enable the flag for a group with indexed vulnerabilities (advanced search on):

    Feature.enable(:security_dashboard_mttr_chart, Group.find_by_full_path('your-group'))
  2. In GraphiQL (/-/graphql-explorer), run:

    {
      group(fullPath: "your-group") {
        securityMetrics {
          mttrOverTime(startDate: "2026-07-13", endDate: "2026-10-04") {
            startDate
            endDate
            count
            sumDays
            mttr
            bySeverity { severity count mttr }
            byReportType { reportType count mttr }
          }
        }
      }
    }
  3. Check there is one bucket per week, with every severity and report type listed.

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.

🤖 Generated with Claude Code

Edited by Harrison Peters

Merge request reports

Loading
Loading