Skip to content

Pulse ​

Add /pulse for application metrics. Run commands in the Laravel application; these notes assume the split-name model and Spatie roles.

Use the project's MySQL/PostgreSQL connection for Pulse. For SQLite CI, check the installed Pulse version first: newer source supports SQLite, while the published docs still list only MySQL, MariaDB, and PostgreSQL.

Install ​

bash
composer require laravel/pulse
php artisan vendor:publish --provider="Laravel\Pulse\PulseServiceProvider"
php artisan migrate

Authorization and User Names ​

File: app/Providers/AppServiceProvider.php (imports and additions to boot())

Keep the existing provider setup.

php
use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Laravel\Pulse\Facades\Pulse;

// Inside boot():
Gate::define('viewPulse', fn (User $user): bool => $user->hasRole('admin'));

Pulse::user(fn (User $user): array => [
    'name' => $user->fullName(),
    'extra' => $user->email,
]);

The user resolver avoids the removed name field. Pulse bypasses the dashboard gate in local; never expose a deployed application with APP_ENV=local.

Configuration ​

File: .env (merge; keep safe defaults in .env.example)

dotenv
PULSE_ENABLED=true
PULSE_PATH=pulse
PULSE_INGEST_DRIVER=storage
PULSE_STORAGE_KEEP="7 days"
PULSE_INGEST_KEEP="7 days"

Set PULSE_DB_CONNECTION only when using a separate connection defined in config/database.php. PULSE_DOMAIN is optional; unset keeps the application's domain.

bash
php artisan config:clear

Recorders ​

File: config/pulse.php

Merge into the existing recorders entries; keep the other recorders and their settings. The published config already imports Laravel\Pulse\Recorders.

php
Recorders\SlowQueries::class => [
    'enabled' => true,
    'threshold' => 100,
],
Recorders\SlowRequests::class => [
    'enabled' => true,
    'threshold' => 1000,
],

Thresholds are milliseconds. Retention lives under storage.trim.keep and ingest.trim.keep; the ingest lottery is ingest.trim.lottery, not trim_lottery. Leave the lottery at its default unless trimming needs tuning.

Dashboard ​

Publish only if changing the default cards:

bash
php artisan vendor:publish --tag=pulse-dashboard

File: resources/views/vendor/pulse/dashboard.blade.php

blade
<x-pulse>
    <livewire:pulse.servers cols="full" />
    <livewire:pulse.usage cols="4" rows="2" />
    <livewire:pulse.queues cols="4" />
    <livewire:pulse.cache cols="4" />
    <livewire:pulse.slow-queries cols="8" />
    <livewire:pulse.exceptions cols="6" />
</x-pulse>

Background Processes ​

Run on each server whose CPU, memory, and disk metrics should appear:

bash
php artisan pulse:check

Default storage ingestion does not need an ingest worker. If switching to PULSE_INGEST_DRIVER=redis, also supervise:

bash
php artisan pulse:work

Use a separate Redis connection from the application queue. Keep long-running processes under Forge or Supervisor, and restart them after deployments:

bash
php artisan pulse:restart

Verify ​

  • Open /pulse, make requests as a signed-in user, and confirm metrics and full names appear.
  • Check server cards while pulse:check is running.
  • In a non-local environment, confirm admins have access and guests/regular users do not.
  • Run migrations and a recording check on the actual CI database engine; configure a separate PULSE_DB_CONNECTION if the installed release does not support it.

References ​