Skip to content

Add extra columns to runner usage CSV

What does this MR do and why?

This MR adds the runner_type and status columns to the runner usage CSV, while also cleaning up the querying logic to make it easier to read.

EE: true

MR acceptance checklist

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

Screenshots or screen recordings

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

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. In the rails console, generate a CSV dump for the top 10 projects and all runner types in an appropriate time window:

    puts Ci::Runners::GenerateUsageCsvService.new(current_user: User.find(1), runner_type: nil, from_date: Date.new(2023, 11, 1), to_date: Date.new(2023, 11, 30), max_project_count: 10).execute.payload[:csv_data]

    Confirm that the new columns are present.

  4. Run the command again, but now for the top 2 projects:

    puts Ci::Runners::GenerateUsageCsvService.new(current_user: User.find(1), runner_type: nil, from_date: Date.new(2023, 11, 1), to_date: Date.new(2023, 11, 30), max_project_count: 2).execute.payload[:csv_data]

    Confirm that the rollup values in Other projects make sense.

Edited by Pedro Pombeiro

Merge request reports