GraphQL: Add support to compute mean duration of pipelines in PipelineAnalytics

In order to support the following UI in the Project CI/CD Analytics page, we need to compute mean duration of pipelines for a project in PipelineAnalytics:

Screenshot 2024-03-28 at 4.15.20 PM.png

We might be able to reuse Resolvers::Ci::RunnersJobsStatisticsResolver in pipelineAnalytics.

This might only be feasible in ClickHouse.

Proposal

{
  project(fullPath: "rf2-top-level-group-1/rf2-group-1.1/rf2-group-1.1.1/rf2-project-1-1-1-1") {
    pipelineAnalytics(finishedAfter: "2023-03-28", finishedBefore: "2024-03-28") {
      # Single stat
      aggregate {
        durationStatistics {
          p50
        }
      }
    }
  }
}
ClickHouse query example

https://clickhouse.com/docs/en/sql-reference/aggregate-functions/reference/quantiles

SELECT quantilesExactExclusive (0.5, 0.75, 0.9, 0.95, 0.99) (duration)
FROM (
  SELECT duration
  FROM ci_finished_pipelines
  WHERE path = '9970/15846663/'
    AND ref = 'master'
    AND source = 'push');

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by Pedro Pombeiro