Skip to content

Prevent timeouts when fetching VSA stage related items with GraphQL

!161510 (merged) added the ability to fetch VSA stage items on GraphQL with queries like the following:

{
  group(fullPath: GROUP_PATH) {
    valueStreams {
      nodes {
        name
        stages {
          name
          metrics(timeframe: { start: "2024-08-01", end: "2024-08-30"}) {
            items {
              nodes {
                duration
                endEventTimestamp
                record {
                  ... on Issue {
                    id
                    title
                  }
                  ... on MergeRequest {
                    id
                    title
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

The problem is a query like this for gitlab-org group times out because it tries to fetch multiple stage items from various value streams. We should investigate how to mitigate these timeouts.

Possible solutions

Try the steps bellow in the following order:

  1. Try to preload value stream stages and stage metrics, this could be challenging so if it is very complicated go to step 2.
  2. Limit value stream max page to something like 10 or 20 or maybe less. We can try to tune to a reasonable count that does not affect UX.
  3. If performance is still poor limit the amount of times stage items can be queried.
  4. Paginate on stages? This may be a weird experience in the UI.
Edited by Gabe Weaver