Handle row for "others" in runner usage breakdown
What does this MR do and why?
Handle row for "others" in runner usage breakdown
In some cases, the results for top runners and top projects may render a
last result that provides a total summary of the remainder projects
and runners with a null
value. This change handles that case.
Changelog: fixed
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
Before | After |
---|---|
How to set up and validate locally
First, ensure your instance has a GitLab Ultimate license.
1. Generating seed data
First, we want a good amount of recent, long duration jobs so they show up in our data.
- Run
bin/rake "gitlab:seed:runner_fleet"
(more about this command)
2. Setting up clickhouse
-
Install clickhouse locally https://clickhouse.com/docs/en/getting-started/quick-start
-
Create two databases
gitlab_clickhouse_development
andgitlab_clickhouse_test
.
Commands to create DBs
$ ./clickhouse client
ClickHouse client version 23.9.1.892 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 23.9.1 revision 54465.
Warnings:
* Maximum number of threads is lower than 30000. There could be problems with handling a lot of simultaneous queries.
mrincon-laptop.local :) CREATE DATABASE IF NOT EXISTS gitlab_clickhouse_test
CREATE DATABASE IF NOT EXISTS gitlab_clickhouse_test
Query id: 503d1675-6b0d-446b-9685-03759a0acb3c
Ok.
0 rows in set. Elapsed: 0.001 sec.
mrincon-laptop.local :) CREATE DATABASE IF NOT EXISTS gitlab_clickhouse_development
CREATE DATABASE IF NOT EXISTS gitlab_clickhouse_development
Query id: dac3bb6e-d7e6-4c6d-bc7e-00e3e0ae7b92
Ok.
0 rows in set. Elapsed: 0.001 sec.
3. Configure GDK
- Locally, create a file called
config/click_house.yml
ingitlab
, with the following contents:
test:
main:
database: gitlab_clickhouse_test
url: 'http://localhost:8123'
username: default
development:
main:
database: gitlab_clickhouse_development
url: 'http://localhost:8123'
username: default
This will tell your instance to look for a clickhouse database at http://localhost:8123
. Even if you don't have one, the dashboard will show in the desired state (with an error at the top).
- Restart your instance (e.g.
gdk restart
) - Run the Clickhouse migrations
bundle exec rake gitlab:clickhouse:migrate
- Force the syncronization service so the Clickhouse data is up to date, in the Rails console (
rails c
), type:
::Ci::Build.where.not(finished_at: nil).find_each{|build| ::Ci::FinishedBuildChSyncEvent.upsert({ build_id: build.id, build_finished_at: build.finished_at }, unique_by: [:build_id, :partition]) }
ClickHouse::DataIngestion::CiFinishedBuildsSyncService.new.execute
4. Verify the result
- Add some
null
values if non are present, they represent the "Others"
diff --git a/ee/app/assets/javascripts/ci/runner/components/runner_usage.vue b/ee/app/assets/javascripts/ci/runner/components/runner_usage.vue
index ac619cbf4477..3fb1181235d9 100644
--- a/ee/app/assets/javascripts/ci/runner/components/runner_usage.vue
+++ b/ee/app/assets/javascripts/ci/runner/components/runner_usage.vue
@@ -30,13 +30,21 @@ export default {
topProjects: {
query: RunnerUsageByProjectQuery,
update(data) {
- return data.runnerUsageByProject;
+ // return data.runnerUsageByProject;
+ return [
+ ...data.runnerUsageByProject,
+ { ciMinutesUsed: 10000, runner: null, __typename: 'CiRunnerUsageByProjectQuery' },
+ ];
},
},
topRunners: {
query: RunnerUsageQuery,
update(data) {
- return data.runnerUsage;
+ // return data.runnerUsage;
+ return [
+ ...data.runnerUsage,
+ { ciMinutesUsed: 10000, runner: null, __typename: 'CiRunnerUsage' },
+ ];
},
},
},
- Visit the dashboard (e.g. http://gdk.test:3000/admin/runners/dashboard)
Related to #421457 (closed)