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 |
---|---|
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
-
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.
-
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.