Fix projectAnalytics.aggregate.durationStatistics nil values

What does this MR do and why?

This MR fixes projectAnalytics.aggregate.durationStatistics so that it returns 0 instead of nil values for the requested percentiles if there are no finished pipelines for the period.

Changelog: fixed

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
image image

How to set up and validate locally

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

  1. Run the following query in http://gdk.test:3000/-/graphql-explorer:

    {
      project(
        fullPath: "gitlab-org/gitlab-shell"
      ) {
        pipelineAnalytics {
          aggregate {
            count
            successCount: count(status: SUCCESS)
            failedCount: count(status: FAILED)
            durationStatistics {
              p50
            }
          }
        }
      }
    }

In this branch, p50 should be zero if there are no pipelines executed for that project (which is likely to be the case). In master it returns nil.

Edited by Pedro Pombeiro

Merge request reports

Loading