Skip to content

Update debug jobs list output

Tomasz Maczukin requested to merge update-debug-jobs-list-output into master

What does this MR do?

Changes the output format of /debug/jobs/list endpoint of internal debug server.

Why was this MR needed?

Currently, if metrics server is configured and enabled, Runner's administrator can list all running jobs and some of their details. We personally use it often when updating a Runner - to see how many jobs there are left during the graceful shutdown. At this moment it generates an output like:

$ curl -s http://localhost:9402/debug/jobs/list
id=XXX url=https://gitlab.com/gitlab-org/gitlab-ee.git state=running stage=build_script executor_stage=docker_run
(...)

While it contains most useful data one of the most repeated tasks that I'm personally doing is to check suspicious jobs. For this I need to manually construct a job URL basing on the values of url and id.

This MR changes generated output to:

$ curl -s http://localhost:9402/debug/jobs/list
url=https://gitlab.com/gitlab-org/gitlab-ee/jobs/-/XXX state=running stage=build_script executor_stage=docker_run duration=3h15m35.3s
(...)

We still can get the URL of a project (just need to skip the /jobs/-/:id part when copying) and we still have the ID of the job printed explicitly. But to see the output of the job it's now super easy to copy just the whole URL, and in most shell terminal it's as easy as click on the URL to open it in a default browser.

This MR adds also a duration field in the job row, so it's now super easy to detect hanging jobs (which is very useful during deployments).

Are there points in the code the reviewer needs to double check?

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

What are the relevant issue numbers?

Edited by 🤖 GitLab Bot 🤖

Merge request reports