Skip to content

Format tooltip wait time values in seconds

Miguel Rincon requested to merge 427734-use-2-decimal-digits-tooltip into master

What does this MR do and why?

This chage adds formatting of in the runner dashboard wait time so they only have two decimals.

Changelog: changed

Screenshots or screen recordings

2023-10-31_16.41.03

Before After
Screenshot_2023-10-31_at_15.50.05 Screenshot_2023-10-31_at_15.49.36

How to set up and validate locally

We will need: 1) local ClickHouse DB, 2) configure our GDK to connect to ClickHouse and 3) Add test data

Local ClickHouse

  1. Follow the instructions to install here: https://clickhouse.com/docs/en/install#quick-install

  2. Connect to the client create two databases:

$ ./clickhouse client
:) create database gitlab_clickhouse_test;
:) create database gitlab_clickhouse_development;
  1. In the rails console, rails c, run:
> require_relative 'spec/support/database/click_house/hooks.rb'
> ClickHouseTestRunner.new.ensure_schema
Click to expand image

Configure GDK to connect

  1. Create a file in our gitlab directory called: config/click_house.yml, add the following:
test:
  main:
    database: gitlab_clickhouse_test
    url: 'http://localhost:8123'
    username: default
development:
  main:
    database: gitlab_clickhouse_development
    url: 'http://localhost:8123'
    username: default
  1. gdk restart so the configuration is loaded

Add test data

  1. Connect to the client and paste the following:
$ ./clickhouse client -d gitlab_clickhouse_development
mrincon-laptop.local :) 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);
Click to expand image

Validation

  1. Run yarn install to update dependencies
  2. Login as admin user to your GDK
  3. Enable Feature.enable(:clickhouse_ci_analytics)
  4. Visit http://gdk.test:3000/admin/runners/dashboard

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #427734 (closed)

Edited by Miguel Rincon

Merge request reports