Skip to content

Add top-K support to runner usage CSV report

Pedro Pombeiro requested to merge pedropombeiro/426562/add-top-k into master

What does this MR do and why?

This MR:

  • improves the implementation of the alpha-stage Mutations::Ci::Runners::ExportUsage mutation, so that the user can specify the number of projects to include in the report.
  • adds a final <Other projects> line containing the aggregations for the projects that didn't make it to the list.

EE: true

Closes #426562 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

image

Before After
image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Start the clickhouse server ./clickhouse server

  2. Run migrations bundle exec rake gitlab:clickhouse:migrate

  3. Run mutation in http://gdk.test:3000/-/graphql-explorer:

    Query:

    mutation runnersExportUsage($input: RunnersExportUsageInput!) {
      runnersExportUsage(input: $input) {
        errors
      }
    }

    Query variables:

    {
      "input": {
      	"type": "INSTANCE_TYPE",
        "topK": 10
    	}
    }

    This will dispatch the worker asynchronously in Sidekiq, and the email should be available shortly in http://gdk.test:3000/rails/letter_opener/.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Pedro Pombeiro

Merge request reports