Skip to content

Discuss how to integrate MR analytics into GLQL

We identified MR analytics as a potential good addition to GLQL data sources, as it would allow to demonstrate the end-to-end flow of how to fully build a useful dashboard, starting from data exploration.

Existing MR analytics are exposed through GraphQL (used in https://gitlab.com/gitlab-org/gitlab/-/analytics/merge_request_analytics):

The connection type for MergeRequest.
"""
type MergeRequestConnection {
  """
  Total count of collection.
  """
  count: Int!

  """
  A list of edges.
  """
  edges: [MergeRequestEdge]

  """
  A list of nodes.
  """
  nodes: [MergeRequest]

  """
  Information to aid in pagination.
  """
  pageInfo: PageInfo!

  """
  Total sum of time to merge, in seconds, for the collection of merge requests.
  """
  totalTimeToMerge: Float
}

Variables

  • fullPath (required): Full path of the project namespace
  • mergedAfter (required): Start date in ISO format
  • mergedBefore (required): End date in ISO format
  • labels (optional): Array of label names to filter by
  • notLabels (optional): Array of label names to exclude
  • authorUsername (optional): Filter by author username
  • assigneeUsername (optional): Filter by assignee username
  • milestoneTitle (optional): Filter by milestone title
  • notMilestoneTitle (optional): Exclude specific milestone
  • sourceBranches (optional): Array of source branches to filter by
  • targetBranches (optional): Array of target branches to filter by

Data Returned:

  • The aggregated sum of time to merge and counts, in seconds, for the requested collection of merge requests

Sample response:

{
    "data": {
        "throughputChartData": {
            "Aug_2024": {
                "count": 2382,
                "totalTimeToMerge": 1492474435.369942,
                "__typename": "MergeRequestConnection"
            },
            "Sep_2024": {
                "count": 2650,
                "totalTimeToMerge": 1761566797.487367,
                "__typename": "MergeRequestConnection"
            },
            "Oct_2024": {
                "count": 3103,
                "totalTimeToMerge": 2086576128.855193,
                "__typename": "MergeRequestConnection"
            },
            "Nov_2024": {
                "count": 2542,
                "totalTimeToMerge": 1662207119.005869,
                "__typename": "MergeRequestConnection"
            },
            "Dec_2024": {
                "count": 2037,
                "totalTimeToMerge": 1380841068.758804,
                "__typename": "MergeRequestConnection"
            },
            "Jan_2025": {
                "count": 2572,
                "totalTimeToMerge": 2251245834.710288,
                "__typename": "MergeRequestConnection"
            },
            "Feb_2025": {
                "count": 2716,
                "totalTimeToMerge": 1946223159.426047,
                "__typename": "MergeRequestConnection"
            },
            "Mar_2025": {
                "count": 2894,
                "totalTimeToMerge": 2020946011.821066,
                "__typename": "MergeRequestConnection"
            },
            "Apr_2025": {
                "count": 2993,
                "totalTimeToMerge": 2021312509.793126,
                "__typename": "MergeRequestConnection"
            },
            "May_2025": {
                "count": 2649,
                "totalTimeToMerge": 1834820303.043201,
                "__typename": "MergeRequestConnection"
            },
            "Jun_2025": {
                "count": 2762,
                "totalTimeToMerge": 2034516437.573138,
                "__typename": "MergeRequestConnection"
            },
            "Jul_2025": {
                "count": 3114,
                "totalTimeToMerge": 1926510508.380342,
                "__typename": "MergeRequestConnection"
            },
            "Aug_2025": {
                "count": 305,
                "totalTimeToMerge": 213443470.061158,
                "__typename": "MergeRequestConnection"
            },
            "__typename": "Project"
        }
    }
}

We want to discuss with the GLQL team here if it's feasible to expose this data through GLQL and what's the best approach to do it. More precisely:

  • Any concern with adding MR analytics to GLQL? Is this something we want to make available widely to GLQL users or does it somehow need to be restricted?
  • Does it need to be a separate data type or can it somehow be combined with the existing mergerequest type
Edited by Daniele Rossetti