Format tooltip wait time values in seconds
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
Before | After |
---|---|
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
-
Follow the instructions to install here: https://clickhouse.com/docs/en/install#quick-install
-
Connect to the
client
create two databases:
$ ./clickhouse client
:) create database gitlab_clickhouse_test;
:) create database gitlab_clickhouse_development;
- In the rails console,
rails c
, run:
> require_relative 'spec/support/database/click_house/hooks.rb'
> ClickHouseTestRunner.new.ensure_schema
Configure GDK to connect
- 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
-
gdk restart
so the configuration is loaded
Add test data
- 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);
Validation
- Run
yarn install
to update dependencies - Login as admin user to your GDK
- Enable
Feature.enable(:clickhouse_ci_analytics)
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #427734 (closed)
Edited by Miguel Rincon