Clockwork 4.1 released with commands, queue jobs, tests profiling and more

Published at Monday, April 6th 2020 by its

A new minor Clockwork release is now available, adding support for commands, queue jobs and tests profiling, improving the timeline, settings and more.

The major new feature in Clockwork 4.1 is the ability to collect new types of requests. Besides your normal HTTP requests, Clockwork now collects executed console commands, queue jobs and tests. All Clockwork features are available, including timeline, log, database queries, dispatched queue jobs, etc.

Commands profiling

Clockwork is now able to collect executed console commands, marked as CMD. Requests list shows the command name with arguments and the exit code. Sidebar shows all command arguments and parameters. Command output can also be collected and shown in a new output tab with support for ANSI colors.

Commands profiling

You can enable collecting of artisan commands in the Clockwork config. Optionally you can collect command output, or set only particular commands to be collected or excluded.

Queue jobs profiling

Clockwork is now able to collect executed queue jobs, marked as QUEUE. Requests list shows the queue job name and the command status. Sidebar shows the job payload, connection, queue name and job options. You can also find the request that dispatched the job in the sidebar with ability to click-through to full details. The queue tab now also shows the status of dispatched jobs with an ability to show full job details.

Queue jobs profiling

You can enable collecting of queue jobs in the Clockwork config. Both default Laravel queue and Horizon are supported. You can also set only particular jobs to be collected or exluded.

Tests profiling

Clockwork is now able to collect executed tests, marked as TEST. Requests list shows the test group, name and the result. Sidebar shows executed asserts, with their status and stack traces.

Tests profiling

Collecting of tests is supported for Laravel apps with the standard PHPUnit testing stack. To enable collecting of tests, enable it in the Clockwork config, and include the Clockwork trait in your base TestCase like this:

use Clockwork\Support\Laravel\Tests\UsesClockwork;

abstract class TestCase extends BaseTestCase
{
    use UsesClockwork;

    protected function setUp() :void
    {
        parent::setUp();
        $this->setUpClockwork();
    }
}

Improved timeline

The timeline is a very useful tool, providing a visual representation of your application runtime. Up until now Clockwork included only few basic events and any other events had to be added manually. From now on, all data collected by Clockwork is shown on the timeline, including database queries, events, cache queries, queue jobs, redis commands, views and emails. Every type of event is represented by a unique icon next to the event name. You can toggle shown event types and Clockwork will remember your preferences.

Improved timeline

New settings modal

The settings modal was completely redesigned. You can now choose your preferred appearance right in the Clockwork app. The default auto setting uses the same theme as your OS or Dev Tools. You can also choose to hide either of the new request types - commands, queue jobs and tests. If you prefer incoming requests to not be automatically active, you can disable this behavior.

New settings modal

If you are using Clockwork browser extension and not interested in profiling commands, queue jobs and tests, make sure these request types are hidden. This considerably lowers the network usage.

Other improvements

Ajax requests are now marked as AJAX in the requests list. Incoming ajax requests are never automatically selected. You can now search requests by type and commands, queue jobs, and tests by name. Requests list no longer shows database timing if none of the requests include database queries.

Views tab was reworked to show rendered views as a timeline and include memory usage if available. You can now set Clockwork to collect rendered views without view data, this is the new default. A new optional Twig data source was added, using a more accurate data from the built-in Twig profiler, but without support for view data.

A new "What's new" screen is shown when the Clockwork app is updated, higlighting the improvements.

This release also includes many smaller fixes and server-side improvements. Symfony support was fixed and updated to work with latest Symfony 4 and 5 releases. You can read the full changelog here.

The Clockwork config was updated with new settings, we recommend to republish the config file if you use a customized one. If you are developing a custom Clockwork extension or integration please see the changelog for some minor breaking changes.

Sponsorship

If you find Clockwork useful, you can now opt-in to become a sponsor on GitHub. Sponsorship is completely optional. Clockwork is and always will be a free software. Another great ways to support the project are sharing ideas or feedback. or simply starring the GitHub repositories.

As an experiment to improve the experience of using Clockwork I've decided to create a Discord for all underground.works projects. Discord is a real-time chat platform, feel free to join if you need support, help putting a pull request together or just want to talk about writing software.

I hope you will enjoy the the new release, please contact me with any feedback and hopefully see you in the Discord!