Skip to content

Commit 43cc019

Browse files
Add documentation for Telescope watchers
1 parent d17e701 commit 43cc019

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

telescope.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@
88
- [Filtering](#filtering)
99
- [Entries](#filtering-entries)
1010
- [Batches](#filtering-batches)
11+
- [Available Watchers](#available-watchers)
12+
- [Cache Watcher](#cache-watcher)
13+
- [Command Watcher](#command-watcher)
14+
- [Dump Watcher](#dump-watcher)
15+
- [Event Watcher](#event-watcher)
16+
- [Exception Watcher](#exception-watcher)
17+
- [Job Watcher](#job-watcher)
18+
- [Log Watcher](#log-watcher)
19+
- [Mail Watcher](#mail-watcher)
20+
- [Model Watcher](#model-watcher)
21+
- [Notification Watcher](#notification-watcher)
22+
- [Query Watcher](#query-watcher)
23+
- [Redis Watcher](#redis-watcher)
24+
- [Request Watcher](#request-watcher)
25+
- [Schedule Watcher](#schedule-watcher)
1126

1227
<a name="introduction"></a>
1328
## Introduction
@@ -160,3 +175,129 @@ While the `filter` callback filters data for individual entries, you may use the
160175
});
161176
});
162177
}
178+
179+
<a name="available-watchers"></a>
180+
## Available Watchers
181+
182+
Telescope watchers gather application profile data when a request or console command is executed. You may customize the list of watchers that you would like to enable in your application within your `config/telescope.php` file:
183+
184+
'watchers' => [
185+
Watchers\CacheWatcher::class => true,
186+
Watchers\CommandWatcher::class => true,
187+
...
188+
],
189+
190+
Some watchers also allow you to also customize certain options:
191+
192+
'watchers' => [
193+
Watchers\QueryWatcher::class => [
194+
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
195+
'slow' => 100,
196+
],
197+
...
198+
],
199+
200+
<a name="cache-watcher"></a>
201+
### Cache Watcher
202+
203+
The Cache Watcher records data when a cache key is hit, missed, updated and forgotten.
204+
205+
<a name="command-watcher"></a>
206+
### Command Watcher
207+
208+
The Command Watcher records the arguments, options, exit code and output whenever an Artisan command is executed. If you would like to exclude certain commands to be recorded by the Command Watcher, you may specify the command in the `ignore` option in your `config/telescope.php` file:
209+
210+
'watchers' => [
211+
Watchers\CommandWatcher::class => [
212+
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
213+
'ignore' => ['key:generate'],
214+
],
215+
...
216+
],
217+
218+
<a name="dump-watcher"></a>
219+
### Dump Watcher
220+
221+
The Dump Watcher records and displays your dumps in Telescope. The Telescope Dump Watcher screen must be open in a browser for the recording to occur, otherwise all dumps will be ignored by the watcher.
222+
223+
<a name="event-watcher"></a>
224+
### Event Watcher
225+
226+
The Event Watcher records the payload, listeners and broadcast data for any events fired by your application. The Laravel Framework events are ignored by the Event Watcher.
227+
228+
<a name="exception-watcher"></a>
229+
### Exception Watcher
230+
231+
The Exception Watcher records the data with the stack trace for any reportable Exceptions that are thrown and logged in your application.
232+
233+
<a name="job-watcher"></a>
234+
### Job Watcher
235+
236+
The Job Watcher records the data and status of any jobs dispatched in your application.
237+
238+
<a name="log-watcher"></a>
239+
### Log Watcher
240+
241+
The Log Watcher records the log data for any logs fired by your application. All logs regardless of the log level will be recorded by the Log Watcher, even if the logs do not meet the log level threshold set in your configuration.
242+
243+
<a name="mail-watcher"></a>
244+
### Mail Watcher
245+
246+
The Mail Watcher allows you to view a preview of the mails sent along with some associated data. You may also download the mail as a .eml file.
247+
248+
<a name="model-watcher"></a>
249+
### Model Watcher
250+
251+
The Model Watcher records model changes whenever an Eloquent `created`, `updated`, `restored` or `deleted` event is fired. You may filter these events further via the `events` option:
252+
253+
'watchers' => [
254+
Watchers\ModelWatcher::class => [
255+
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
256+
'events' => ['eloquent.created*', 'eloquent.updated*'],
257+
],
258+
...
259+
],
260+
261+
<a name="notification-watcher"></a>
262+
### Notification Watcher
263+
264+
The Notification Watcher records the notification data whenever a Laravel Notification is triggered. If the notification triggers a mail and you have the Mail Watcher enabled, the mail will also be available for preview and download in the Telescope Mail Watcher screen.
265+
266+
<a name="query-watcher"></a>
267+
### Query Watcher
268+
269+
The Query Watcher records the raw SQL, bindings and time taken by the queries fired by your application. This watcher also tags any queries slower than 100ms as `slow`. You may customize this time using the `slow` option:
270+
271+
272+
'watchers' => [
273+
Watchers\QueryWatcher::class => [
274+
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
275+
'slow' => 50,
276+
],
277+
...
278+
],
279+
280+
<a name="redis-watcher"></a>
281+
### Redis Watcher
282+
283+
> {note} Redis events must be enabled for the Redis Watcher to work. You may enable Redis events by calling `Redis::enableEvents()` in the `boot` method of your `app/Providers/AppServiceProvider.php` file.
284+
285+
The Redis Watcher records all Redis commands executed by your application. If you are using Redis for caching, cache commands will also be recorded by the Redis Watcher.
286+
287+
<a name="request-watcher"></a>
288+
### Request Watcher
289+
290+
The Request Watcher records the request, headers, session and response data associated with any requests handled by the application. You may purge your response data via the `size_limit` (in KB) option:
291+
292+
'watchers' => [
293+
Watchers\RequestWatcher::class => [
294+
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
295+
'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64),
296+
],
297+
...
298+
],
299+
300+
<a name="schedule-watcher"></a>
301+
### Schedule Watcher
302+
303+
The Schedule Watcher records the command and output data of any scheduled tasks run by your application.

0 commit comments

Comments
 (0)