Skip to content

Include null values in DORA metrics API response

Felipe Cardozo requested to merge issue_393464 into master

What does this MR do and why?

Include null values in DORA metrics API response

When a user selects date alongside DORA metrics on GraphQL we include placeholders with nil values for dates that do not have data. For example, assume that a Project/Group has the following DORA metrics:

{ date: 2023-06-15, DeploymentFrequency: 0.3 },
{ date: 2023-06-18, DeploymentFrequency: 0,7 }

After this MR, if a user selects DORA metrics from 2023-06-15 to 2023-06-18 the API will return:

{ date: 2023-06-15, DeploymentFrequency: 0.3 },
{ date: 2023-06-16, DeploymentFrequency: nil },
{ date: 2023-06-17, DeploymentFrequency: nil },
{ date: 2023-06-18, DeploymentFrequency: 0,7 }

This helps frontend to pass data between components. More information at #393464 (closed)

How to set up and validate locally

  1. Run the following seed: FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu
  2. Take the project path from the seed output and use in the following GraphQL query:

The seed generates data for the last 100 days we need to adjust the query startDate to be before earlier than that in order to have some nil data filled:

 query doraForProject{
  project(fullPath: "PROJECT_PATH") {
 		dora {
      metrics(startDate: "2023-02-21", endDate: "2023-07-21") {
        date
        deploymentFrequency
        changeFailureRate
        timeToRestoreService
        leadTimeForChanges
      }
     }
   }
 }

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 Felipe Cardozo

Merge request reports

Loading