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 | |
Generated CSV |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Start the clickhouse server ./clickhouse server
-
Run migrations
bundle exec rake gitlab:clickhouse:migrate
-
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.
-
I have evaluated the MR acceptance checklist for this MR.