Skip to content

Add mutation to send runner usage analytics csv export

What does this MR do and why?

This MR adds the ability to generate a runner usage report that lists the top 500 projects that consumed runner minutes in the GitLab instance. The report is triggered by a new GraphQL and sent by email once ready. Note: Each commit is reviewable individually.

There will be a few follow-up MRs to improve the implementation:

  • Allow configuring the number of projects, e.g. give me the top 10 projects using runner minutes, and aggregate the rest under Other
  • Add audit event for operation

EE: true

Part of:

Screenshots or screen recordings

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

Step Screenshot
GraphQL mutation image
E-mail image
Generated CSV 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"
    	}
    }

    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

Loading