Skip to content

Expose DORA scores via GraphQL

charlie ablett requested to merge 411537_cablett-dora-score-counts into master

What does this MR do and why?

Expose DORA scores via GraphQL

Changelog: added EE: true

How to set up and validate locally

  1. Create some DORA metrics for the previous whole month (e.g. if it's 23 May 2023 right now, create them for 1 April 2023) under a bunch of projects in a target group (e.g. flightjs).

  2. Use the following GraphQL query:

query {
  group(fullPath: "flightjs") {
    doraPerformanceScoreCounts {
      nodes {
        metricName
        lowProjectsCount
        mediumProjectsCount
        highProjectsCount
        noDataProjectsCount
      }
    }
  }
}

database queries

.for_dates scope

SELECT "dora_performance_scores".*
FROM "dora_performance_scores"
WHERE "dora_performance_scores"."date" = '2023-04-01'

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/18829/commands/62486

.group_counts_by_metric scope - group by lead_time_for_changes

SELECT COUNT(*) AS count_all, "dora_performance_scores"."lead_time_for_changes"
AS dora_performance_scores_lead_time_for_changes
FROM "dora_performance_scores"
GROUP BY "dora_performance_scores"."lead_time_for_changes"

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/18829/commands/62487

.for_projects scope

SELECT "dora_performance_scores".*
FROM "dora_performance_scores"
WHERE "dora_performance_scores"."project_id" = 278964

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/18829/commands/62488

combined

SELECT COUNT(*) AS count_all, "dora_performance_scores"."lead_time_for_changes"
AS dora_performance_scores_lead_time_for_changes
FROM "dora_performance_scores"
WHERE "dora_performance_scores"."date" = '2023-04-01' AND "dora_performance_scores"."project_id" = 278964
GROUP BY "dora_performance_scores"."lead_time_for_changes"

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/18829/commands/62489

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by charlie ablett

Merge request reports