Observability
Observability
Section titled “Observability”KoAkademy ships four developer observability tools. They live outside the Filament panel and the admin workspace, each on its own path. When enabled and permitted, they appear in the admin panel sidebar under the Observability group (each opens in a new tab).
| Tool | Default path | Who can open it | Enable flag |
|---|---|---|---|
| Laralyze | /laralyze |
Primary role or Spatie role developer / super_admin |
LARALYZE_ENABLED (default on) |
| Pulse | /pulse |
Spatie role super_admin (or the configured admin e-mail) |
PULSE_ENABLED (default off in .env.example) |
| Telescope | /telescope |
Spatie role developer |
TELESCOPE_ENABLED (default off in .env.example) |
| Horizon | /horizon |
Primary role super_admin or Spatie role super_admin |
Installed only in the production Docker images |
Paths for Laralyze, Pulse, and Telescope are configurable (laralyze.path, pulse.path, telescope.path). Horizon is only registered when the package is present — see bootstrap/providers.php.
Laralyze
Section titled “Laralyze”Self-hosted production monitoring (requests, jobs, queries, exceptions, cache, AI calls, logs, users, visits). Installed via mohammed-mojaly/laralyze; config at config/laralyze.php, tables laralyze_*.
Access is decided by the viewLaralyze gate (app/Providers/AppServiceProvider.php, enforced first in app/Providers/AuthServiceProvider.php):
- primary
users.roleisdeveloperorsuper_admin, or - Spatie role is
developerorsuper_admin.
Guests and all other roles get 403. The account’s Spatie roles are managed on the Users edit page (role is the primary column, roles[] are Spatie roles) — a user with primary admin but Spatie super_admin is allowed.
Production notes:
- Run
php artisan migrate --forceafter deploy (Laralyze tables are pending until then), thenphp artisan optimizeandphp artisan queue:restart. - The scheduler must run every minute (Laralyze trim/digest/server tasks). The Docker images already run it via Supercronic.
- Ask AI (
LARALYZE_ASSISTANT_ENABLED) is off by default because it can send recorded context and readable application code to the configured AI provider. Tests forceLARALYZE_ENABLED=false(phpunit.xml). - Log in on the admin host (
ADMIN_HOST, e.g.admin.dccp.edu.ph) and open/laralyzeon that same host. Session cookies are host-only (SESSION_DOMAINunset), so a session from the portal host is not sent to the admin host and vice versa.
Request/queue/cache performance dashboard. Gate viewPulse (app/Providers/PulseServiceProvider.php) allows the configured admin e-mail or Spatie super_admin. Disabled by default for a minimal local setup (TELESCOPE_ENABLED=false, PULSE_ENABLED=false in .env.example), and the configuration default is off as well, so a deployment that omits the variable records nothing.
The recorders sample rather than record everything: cache interactions keep 5% of the events, requests and slow queries 10%, queues and user jobs 50%. Exceptions and slow jobs are kept in full because they are rare and every occurrence matters. Each rate is overridable (PULSE_CACHE_INTERACTIONS_SAMPLE_RATE and friends).
The storage ingest driver writes every recorded entry to the database during the request that produced it. Set PULSE_INGEST_DRIVER=redis to buffer the entries and flush them in the background instead.
Telescope
Section titled “Telescope”Debug assistant for exceptions, failed requests/jobs, and scheduled tasks. Gate viewTelescope (app/Providers/TelescopeServiceProvider.php) allows Spatie role developer. Outside local, Telescope records only reportable exceptions, failed requests/jobs, scheduled tasks, and monitored tags, and hides _token plus cookie/auth headers. The configuration default is off, so a deployment that omits TELESCOPE_ENABLED records nothing.
Horizon
Section titled “Horizon”Redis queue dashboard. Only installed in the production Docker images and only registered when the package exists. Gate viewHorizon (app/Providers/AuthServiceProvider.php) allows primary super_admin or Spatie super_admin.
Logs & retention
Section titled “Logs & retention”System Management → Logs & Retention (View:SystemManagementLogRetention, Update:SystemManagementLogRetention) purges or schedules cleanup of what those tools record.
| Source | Tables / model | Deleted by cleanup |
|---|---|---|
| Pulse | pulse_entries, pulse_values, pulse_aggregates |
Records older than the retention period, or all of them on purge |
| Telescope | telescope_entries (tags cascade) |
Entries older than the retention period, or all of them on purge |
| the configured mail model plus its events, attachments, and mailables | Logged messages older than the retention period, or all of them on purge — with their stored attachment files | |
| Activity | the configured activity model | Audit records older than the retention period, or all of them on purge |
What cleanup deliberately leaves alone:
- Students, enrollments, finance, and every other school record.
- Mail records with an unsuppressed hard bounce, complaint, or unsubscribe — the suppression list keeps working after a purge.
- Telescope monitored tags (
telescope_monitoring); only the entries and their per-entry tags go. - Activity records under the
system-log-maintenancelog name, which hold the cleanup audit trail.
Behavior worth knowing:
- Deletion is instance-wide. A purge affects every school, so the page says so before you confirm.
- Each action requires typing
PRUNEorPURGE. Cleanup runs on the queue in bounded batches (CleanSystemLogs), continues in a fresh job for large sources, and is serialized per source by both a queue lock and the overlap middleware. A second request for a source that already has a queued or running cleanup is rejected. - A run snapshots the highest primary key per table when it is queued, so records written after you confirm are never deleted by that run.
- Recording is never switched off by cleanup. Pulse, Telescope, and the mail and activity loggers keep collecting, and dashboards fill with fresh data immediately. Pulse also keeps its own
PULSE_STORAGE_KEEPtrim, which is independent of the schedule here. - Sources whose storage is not usable (non-database Pulse/Telescope driver, missing tables, unreadable connection) are reported as Storage not configured or Storage unavailable with a Retry action; the rest of the page still loads, and cleanup for that source is refused instead of silently doing nothing.
- Schedule fields are read from
general_settings.more_configs['log_retention']on every scheduler tick, so saving a schedule needs no deploy and no container restart. - Defaults match the package configuration: Pulse 7 days, Telescope 1 day (enabled in production, which preserves the previous daily
telescope:prune --hours=24behavior), Mail 30 days (mails.database.pruning.after), Activity 365 days (activitylog.delete_records_older_than_days). The other schedules start disabled. php artisan system-logs:prune-dueruns every minute viaonOneServer()and queues each due source at most once per minute. Cleanup needs the scheduler and a queue worker; a worker that is not running leaves runs queued and visible in Cleanup history.
Deploy notes:
- Run
php artisan migrate --force. Two migrations are involved:log_cleanup_runs(run history) and the permission grant for the new section. Without them the page loads with a Migration required notice and cleanup stays disabled. - After changing this area’s code, run
php artisan optimize:clearand reload Octane / restart the container, since gates and policies are held in worker memory.
Troubleshooting 403
Section titled “Troubleshooting 403”- Role mismatch — check both sources:
users.rolecolumn and Spatiemodel_has_roles. Intinker:Gate::forUser($u)->allows('viewLaralyze'). - Wrong host / guard — Laralyze uses the
webguard (staffUser, not portalAccount) with noauthredirect, so a missing session shows as 403. Use the admin host you logged in on. - Stale workers — FrankenPHP Octane keeps gates in memory. After deploy:
php artisan optimize:clear, reload Octane / restart the container, and confirmphp artisan aboutshows LaralyzeENABLEDwith healthOK.
