Skip to content

[VSA] Add GraphQL aggregation metrics

This issue is for exposing the aggregations within a value stream analytics stage. Currently we have the following aggregations:

  • Count (limited count, maximum value is 10001)
  • Median duration
  • Average duration

Additionally, the metrics can be filtered by:

  • author
  • assignee
  • label
  • milestone
  • end event timestamp

Let's extend the stages node with metrics:

group(fullPath: "gitlab-org") { // or project
  valueStreamAnalytics {
    valueStreams(id: '') {
      // already implemented fields
      stages(id: '') {
        // already implemented fields
        metrics(assignee_username: ...) { // arguments from Resolvers::Analytics::CycleAnalytics::BaseIssueResolver
          median { // Types::Analytics::CycleAnalytics::MetricType
            value
            title
          }
          average { // Types::Analytics::CycleAnalytics::MetricType
          }
          count { // Types::Analytics::CycleAnalytics::MetricType
          }
        }
      }
    }
  }
}

Implementation

  • Implement the GraphQL resolver.
  • When retrieving the input arguments, use the Gitlab::Analytics::CycleAnalytics::RequestParams class to prepare the params for the data collector.
  • Invoke the data collector and call the aggregation method (count, median, etc): Gitlab::Analytics::CycleAnalytics::DataCollector.
  • You can see the current invocation of these classes in the private API: Analytics::CycleAnalytics::StageActions module.
Edited by Adam Hegyi