Skip to content

Display the top 5 "active" instance runners with their "in progress" jobs

Details

In order to get closer to giving users a better concept of how "busy" their runner is at the moment, we should display the top 5 runners with the most in progress jobs in the Fleet Overview Dashboard.

Proposal

Add a card to the Fleet Overview dashboard with the top 5 instance runners with the most in progress jobs.

  • Use the running status icon
  • Link to the runner's jobs tab

See designs in design management

🎨 Figma file

Database

As mentioned in the exploration below, we can use the existing ci_running_builds table to compute the required metrics. Initially, this will only be available for jobs executed by instance runners due to the fact that ci_running_builds is only populated for that type of runners. Once we prove the concept, we can look into expanding the implementation so that ci_running_builds is populated for all runner types.

The query would look something like:

SELECT *
FROM (
  SELECT runner_id, COUNT(runner_id) AS job_count
  FROM ci_running_builds
  GROUP BY runner_id
  ORDER BY job_count DESC
  LIMIT 5) runners_by_jobs
  INNER JOIN ci_runners ON runners_by_jobs.runner_id = ci_runners.id;

GraphQL

We could add a new filter to the Resolvers::Ci::RunnersResolver class (filterByMetrics below), which would be an enum representing possible predefined queries that could be used for different metrics:

{
  runners(type: INSTANCE_TYPE, filterByMetrics: MOST_ACTIVE) {
    count
    edges {
      webUrl
      node {
        id
        jobCount(statuses: [RUNNING])
      }
    }
  }
}

The Ci::RunnersFinder class could raise an error if we try to use filterByMetrics: MOST_ACTIVE without type: INSTANCE_TYPE (this limitation should also be documented in the MOST_ACTIVE enum value). Adding filterByMetrics: MOST_ACTIVE would also automatically limit the number of records returned, in order to reduce load on the database.

Further details

This is related to #372869 (closed).

Edited by Gina Doyle