Imported from enotech-inc/open-flow-laravel-sdk (
.github/skills/telescope-debugging/SKILL.md). Install upstream withnpx skills add enotech-inc/open-flow-laravel-sdk --skill telescope-debugging. Copyright stays with the author.
Telescope records every request, job, and command as a batch: the entry itself and every query, cache operation, log, event, exception, and view it produced. The two commands below read this data from the terminal. Prefer them to the web UI.
Workflow
-
Find the entry. Run
php artisan telescope:list request(orexception,job,query, orcache). Choose the row by URI, class, or duration, then copy its UUID. Skip this step when you want the most recent entry. -
Show the batch. Run
php artisan telescope:show <uuid>, orphp artisan telescope:show latest:request. The output is the entry's own detail followed by Queries, Exceptions, Cache, and Logs sections, all from the same batch. -
Diagnose from the flags. In the Queries table,
DUPmarks queries with the same SQL pattern, which usually indicates an N+1. TheSourcecolumn shows the file and line that ran the query, shortened to a basename; use--jsonfor the full path.SLOWmarks queries over the configured threshold. The Cache header shows hits, misses, and hit rate. An exception entry shows the message, code context, and stack trace. -
Finish when the finding identifies a file and line or a specific query, rather than only a symptom.
JSON output
Both commands accept --json. Prefer it to table output when you need exact values, want to filter results, or expect long output. telescope:list --json prints an array of entries. telescope:show --json prints {"entry": {...}, "batch": [...]}. Its batch array is in chronological order and already filtered by --type. When no entries match, telescope:list --json prints [] rather than a message.
Every entry has id, batch_id, type, content, family_hash, and created_at. The content keys match the Telescope UI for that type. For example, a query has sql, time, slow, file, and line, while an exception has class, message, file, line, and trace. Two fields are not populated by these commands: tags is always [] (use --tag to filter rather than reading tags from the output), and sequence is null when the entry is addressed by UUID.
# Exception class, message, and location for the latest exception
php artisan telescope:show latest:exception --json | jq '.entry.content | {class, message, file, line}'
# Slow queries in the latest request, with the file that ran them
php artisan telescope:show latest:request --json --type=query | jq '.batch[] | select(.content.slow) | {sql: .content.sql, time: .content.time, file: .content.file, line: .content.line}'
# Repeated SQL patterns in a request (N+1 candidates), most repeated first
php artisan telescope:show latest:request --json --type=query | jq '[.batch[].content.sql] | group_by(.) | map({sql: .[0], count: length}) | sort_by(-.count) | .[] | select(.count > 1)'
# Recent 500 responses
php artisan telescope:list request --json --limit=50 | jq '.[] | select(.content.response_status >= 500) | {id, uri: .content.uri, status: .content.response_status}'
# Failed jobs and their exception messages
php artisan telescope:list job --json | jq '.[] | select(.content.status == "failed") | {id, name: .content.name, error: .content.exception.message}'
Reference
latestandlatest:{type}resolve to the most recent entry without a UUID lookup. Any entry type works, includinglatest:queryandlatest:job.--jsonon either command disables truncation, so--fullis only needed for table output.telescope:show <id> --fulldisables truncation of SQL, messages, and payloads.telescope:show <id> --type=query,exceptionlimits batch context to those types when a request produced hundreds of entries.telescope:list --tag=Auth:42filters entries for one authenticated user, because Telescope tags them withAuth:<user id>.--batch=<id>lists every entry from one request.--before=<sequence>pages backward using the cursor printed in the footer.--family=<hash>groups recurrences of one exception; read the hash from thefamily_hashfield in--jsonoutput.- Run either command with
--helpfor the full option list and valid entry types.