Draft: [skip ci] Read Orbit graph counts from GraphQL in the dashboard and Duo readiness row

What does this MR do and why?

The Orbit overview page, the schema page, and the Duo readiness row read graph counts from REST graph_status, with one request for each group. With 50 groups, one page load sent 50 requests, and each group had a limit of 10 requests per minute. This MR reads the same data from GraphQL, with one request for all groups.

  • The dashboard app holds one counts query for all groups. The overview page and the schema page read its result.
  • The client adds up the counts of all groups.
  • The counts query runs only on the Overview and Schema tabs.
  • The counts stay in the local storage cache (item-counts:<user ID>) for 5 minutes. A change in the indexing state of a group starts a new request. The 20-second poll, a tab change, and a page reload use the cache.
  • The readiness row reads indexing.lastCompletedAt for the project.
query getOrbitItemCounts($first: Int = 50) {
  orbit {
    memberGroups(enabled: true, first: $first) {
      nodes { id orbit { itemCounts { domains { name entities { name count } } } } }
    }
  }
}

If any group has no counts, the schema page shows no counts, because a partial sum looks like the real count. The overview card shows "Counts are not available right now" when no group has counts. It never shows "0 items" for missing data.

This MR deletes graph_stats.js, fetchGraphStatus, and the graph-status local storage cache.

References

Related to gitlab-org/orbit/knowledge-graph#263

Screenshots or screen recordings

These numbers are for one overview page load on a GDK, with Orbit in SaaS mode.

Overview page 6 groups, before 6 groups, after 50 groups, before 50 groups, after
REST graph_status requests 6 0 50 0
GraphQL counts requests 0 1 0 1
Count gRPC calls 6 1 50 1
ClickHouse count queries 6 6 50 50
Stats card ready, median of 3 runs, development mode 3.3 s 3.1 s 8.8 s 5.5 s

The counts in the UI are the same before and after. The REST and GraphQL counts are equal for all 50 groups.

Before After
before-50 mr2-50
Schema page Duo readiness row
mr2-50-schema-entity mr2-root-readiness

How to set up and validate locally

  1. Sign in as a user who is a member of 2 or more groups with Orbit turned on.
  2. Go to Your work > GitLab Orbit.
  3. In the browser network panel, make sure that the page sends one getOrbitItemCounts request and no graph_status request.
  4. Select Schema, then Overview. Make sure that no new getOrbitItemCounts request starts.
  5. Reload the page. Make sure that no new getOrbitItemCounts request starts.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Michael Angelo Rivera

Merge request reports

Loading
Loading