Skip to content

Refactor runner wait time component

What does this MR do and why?

This change splits the functionality of the runner wait time in two so fetching and display logic are separate.

There are no user-facing changes.

Technical details

When we add our group dashboard, it will be useful to keep the component presentation and fetching components separate, as I can reuse the presentation component (runner_wait_times.vue) in both dashboards.

runner_wait_times.vue (apollo & metrics) => admin_runners_wait_times.vue (apollo) + runner_wait_times.vue (metrics)

MR acceptance checklist

Screenshots or screen recordings

Related component
image

How to set up and validate locally

  1. Ensure you have Clickhouse installed in our GDK (https://docs.gitlab.com/ee/development/database/clickhouse/clickhouse_within_gitlab.html).

  2. Update the schema by using: bundle exec rake gitlab:clickhouse:migrate (if this doesn't work, you may have an issue with your install)

  3. Seed build data into our Clickhouse database.

Run clickhouse client --port 9001 -d gitlab_clickhouse_development to connect to the database and then run:

INSERT INTO ci_finished_builds
    (id, project_id, pipeline_id, status, finished_at, created_at, started_at, queued_at,
     runner_id, runner_manager_system_xid, runner_run_untagged, runner_type,
     runner_manager_version, runner_manager_revision, runner_manager_platform, runner_manager_architecture)
SELECT
    number AS id,
    toUInt64(1 * pow(1 - (rand() / 4294967295.0), -1/1.0)) AS project_id,
    toUInt64(1 * pow(1 - (rand() / 4294967295.0), -1/1.0)) AS pipeline_id,
    arrayElement(['success', 'success', 'success', 'success', 'success', 'failed', 'failed', 'cancelled'], 1 + (rand() % 8)) AS status,
    (now() - toIntervalSecond(rand() % (86400 * 30))) AS finished_at,
    (finished_at - toIntervalSecond(-600 * ln(1 - rand() / 4294967295.0))) AS started_at,
    (started_at - toIntervalSecond(-10 * ln(1 - rand() / 4294967295.0))) AS queued_at,
    (queued_at - toIntervalSecond(-10 * ln(1 - rand() / 4294967295.0))) AS created_at,
    rand() % 10000 AS runner_id,
    toString(rand() % 1000) AS runner_manager_system_xid,
    rand() % 2 AS runner_run_untagged,
    rand() % 3 + 1 AS runner_type,
    '' AS runner_manager_version,
    '' AS runner_manager_revision,
    '' AS runner_manager_platform,
    '' AS runner_manager_architecture
FROM numbers(300000);
  1. Visit the runners dashboard: http://gdk.test:3000/admin/runners/dashboard

  2. Ensure the chart is shown with data correctly.

Related to #424790 (closed)

Edited by Miguel Rincon

Merge request reports