]> BookStack Code Mirror - bookstack/blob - app/Config/clockwork.php
Reverted shift change to old migration
[bookstack] / app / Config / clockwork.php
1 <?php
2
3 return [
4
5         /*
6         |------------------------------------------------------------------------------------------------------------------
7         | Enable Clockwork
8         |------------------------------------------------------------------------------------------------------------------
9         |
10         | Clockwork is enabled by default only when your application is in debug mode. Here you can explicitly enable or
11         | disable Clockwork. When disabled, no data is collected and the api and web ui are inactive.
12         |
13         */
14
15         'enable' => env('CLOCKWORK_ENABLE', false),
16
17         /*
18         |------------------------------------------------------------------------------------------------------------------
19         | Features
20         |------------------------------------------------------------------------------------------------------------------
21         |
22         | You can enable or disable various Clockwork features here. Some features have additional settings (eg. slow query
23         | threshold for database queries).
24         |
25         */
26
27         'features' => [
28
29                 // Cache usage stats and cache queries including results
30                 'cache' => [
31                         'enabled' => true,
32
33                         // Collect cache queries
34                         'collect_queries' => true,
35
36                         // Collect values from cache queries (high performance impact with a very high number of queries)
37                         'collect_values' => false
38                 ],
39
40                 // Database usage stats and queries
41                 'database' => [
42                         'enabled' => true,
43
44                         // Collect database queries (high performance impact with a very high number of queries)
45                         'collect_queries' => true,
46
47                         // Collect details of models updates (high performance impact with a lot of model updates)
48                         'collect_models_actions' => true,
49
50                         // Collect details of retrieved models (very high performance impact with a lot of models retrieved)
51                         'collect_models_retrieved' => false,
52
53                         // Query execution time threshold in miliseconds after which the query will be marked as slow
54                         'slow_threshold' => null,
55
56                         // Collect only slow database queries
57                         'slow_only' => false,
58
59                         // Detect and report duplicate (N+1) queries
60                         'detect_duplicate_queries' => false
61                 ],
62
63                 // Dispatched events
64                 'events' => [
65                         'enabled' => true,
66
67                         // Ignored events (framework events are ignored by default)
68                         'ignored_events' => [
69                                 // App\Events\UserRegistered::class,
70                                 // 'user.registered'
71                         ],
72                 ],
73
74                 // Laravel log (you can still log directly to Clockwork with laravel log disabled)
75                 'log' => [
76                         'enabled' => true
77                 ],
78
79                 // Sent notifications
80                 'notifications' => [
81                         'enabled' => true,
82                 ],
83
84                 // Performance metrics
85                 'performance' => [
86                         // Allow collecting of client metrics. Requires separate clockwork-browser npm package.
87                         'client_metrics' => true
88                 ],
89
90                 // Dispatched queue jobs
91                 'queue' => [
92                         'enabled' => true
93                 ],
94
95                 // Redis commands
96                 'redis' => [
97                         'enabled' => true
98                 ],
99
100                 // Routes list
101                 'routes' => [
102                         'enabled' => false,
103
104                         // Collect only routes from particular namespaces (only application routes by default)
105                         'only_namespaces' => [ 'App' ]
106                 ],
107
108                 // Rendered views
109                 'views' => [
110                         'enabled' => true,
111
112                         // Collect views including view data (high performance impact with a high number of views)
113                         'collect_data' => false,
114
115                         // Use Twig profiler instead of Laravel events for apps using laravel-twigbridge (more precise, but does
116                         // not support collecting view data)
117                         'use_twig_profiler' => false
118                 ]
119
120         ],
121
122         /*
123         |------------------------------------------------------------------------------------------------------------------
124         | Enable web UI
125         |------------------------------------------------------------------------------------------------------------------
126         |
127         | Clockwork comes with a web UI accessibla via http://your.app/clockwork. Here you can enable or disable this
128         | feature. You can also set a custom path for the web UI.
129         |
130         */
131
132         'web' => true,
133
134         /*
135         |------------------------------------------------------------------------------------------------------------------
136         | Enable toolbar
137         |------------------------------------------------------------------------------------------------------------------
138         |
139         | Clockwork can show a toolbar with basic metrics on all responses. Here you can enable or disable this feature.
140         | Requires a separate clockwork-browser npm library.
141         | For installation instructions see https://underground.works/clockwork/#docs-viewing-data
142         |
143         */
144
145         'toolbar' => true,
146
147         /*
148         |------------------------------------------------------------------------------------------------------------------
149         | HTTP requests collection
150         |------------------------------------------------------------------------------------------------------------------
151         |
152         | Clockwork collects data about HTTP requests to your app. Here you can choose which requests should be collected.
153         |
154         */
155
156         'requests' => [
157                 // With on-demand mode enabled, Clockwork will only profile requests when the browser extension is open or you
158                 // manually pass a "clockwork-profile" cookie or get/post data key.
159                 // Optionally you can specify a "secret" that has to be passed as the value to enable profiling.
160                 'on_demand' => false,
161
162                 // Collect only errors (requests with HTTP 4xx and 5xx responses)
163                 'errors_only' => false,
164
165                 // Response time threshold in miliseconds after which the request will be marked as slow
166                 'slow_threshold' => null,
167
168                 // Collect only slow requests
169                 'slow_only' => false,
170
171                 // Sample the collected requests (eg. set to 100 to collect only 1 in 100 requests)
172                 'sample' => false,
173
174                 // List of URIs that should not be collected
175                 'except' => [
176                         '/horizon/.*', // Laravel Horizon requests
177                         '/telescope/.*', // Laravel Telescope requests
178                         '/_debugbar/.*', // Laravel DebugBar requests
179                 ],
180
181                 // List of URIs that should be collected, any other URI will not be collected if not empty
182                 'only' => [
183                         // '/api/.*'
184                 ],
185
186                 // Don't collect OPTIONS requests, mostly used in the CSRF pre-flight requests and are rarely of interest
187                 'except_preflight' => true
188         ],
189
190         /*
191         |------------------------------------------------------------------------------------------------------------------
192         | Artisan commands collection
193         |------------------------------------------------------------------------------------------------------------------
194         |
195         | Clockwork can collect data about executed artisan commands. Here you can enable and configure which commands
196         | should be collected.
197         |
198         */
199
200         'artisan' => [
201                 // Enable or disable collection of executed Artisan commands
202                 'collect' => false,
203
204                 // List of commands that should not be collected (built-in commands are not collected by default)
205                 'except' => [
206                         // 'inspire'
207                 ],
208
209                 // List of commands that should be collected, any other command will not be collected if not empty
210                 'only' => [
211                         // 'inspire'
212                 ],
213
214                 // Enable or disable collection of command output
215                 'collect_output' => false,
216
217                 // Enable or disable collection of built-in Laravel commands
218                 'except_laravel_commands' => true
219         ],
220
221         /*
222         |------------------------------------------------------------------------------------------------------------------
223         | Queue jobs collection
224         |------------------------------------------------------------------------------------------------------------------
225         |
226         | Clockwork can collect data about executed queue jobs. Here you can enable and configure which queue jobs should
227         | be collected.
228         |
229         */
230
231         'queue' => [
232                 // Enable or disable collection of executed queue jobs
233                 'collect' => false,
234
235                 // List of queue jobs that should not be collected
236                 'except' => [
237                         // App\Jobs\ExpensiveJob::class
238                 ],
239
240                 // List of queue jobs that should be collected, any other queue job will not be collected if not empty
241                 'only' => [
242                         // App\Jobs\BuggyJob::class
243                 ]
244         ],
245
246         /*
247         |------------------------------------------------------------------------------------------------------------------
248         | Tests collection
249         |------------------------------------------------------------------------------------------------------------------
250         |
251         | Clockwork can collect data about executed tests. Here you can enable and configure which tests should be
252         | collected.
253         |
254         */
255
256         'tests' => [
257                 // Enable or disable collection of ran tests
258                 'collect' => false,
259
260                 // List of tests that should not be collected
261                 'except' => [
262                         // Tests\Unit\ExampleTest::class
263                 ]
264         ],
265
266         /*
267         |------------------------------------------------------------------------------------------------------------------
268         | Enable data collection when Clockwork is disabled
269         |------------------------------------------------------------------------------------------------------------------
270         |
271         | You can enable this setting to collect data even when Clockwork is disabled. Eg. for future analysis.
272         |
273         */
274
275         'collect_data_always' => false,
276
277         /*
278         |------------------------------------------------------------------------------------------------------------------
279         | Metadata storage
280         |------------------------------------------------------------------------------------------------------------------
281         |
282         | Configure how is the metadata collected by Clockwork stored. Two options are available:
283         |   - files - A simple fast storage implementation storing data in one-per-request files.
284         |   - sql - Stores requests in a sql database. Supports MySQL, Postgresql, Sqlite and requires PDO.
285         |
286         */
287
288         'storage' => 'files',
289
290         // Path where the Clockwork metadata is stored
291         'storage_files_path' => storage_path('clockwork'),
292
293         // Compress the metadata files using gzip, trading a little bit of performance for lower disk usage
294         'storage_files_compress' => false,
295
296         // SQL database to use, can be a name of database configured in database.php or a path to a sqlite file
297         'storage_sql_database' => storage_path('clockwork.sqlite'),
298
299         // SQL table name to use, the table is automatically created and udpated when needed
300         'storage_sql_table' => 'clockwork',
301
302         // Maximum lifetime of collected metadata in minutes, older requests will automatically be deleted, false to disable
303         'storage_expiration' => 60 * 24 * 7,
304
305         /*
306         |------------------------------------------------------------------------------------------------------------------
307         | Authentication
308         |------------------------------------------------------------------------------------------------------------------
309         |
310         | Clockwork can be configured to require authentication before allowing access to the collected data. This might be
311         | useful when the application is publicly accessible. Setting to true will enable a simple authentication with a
312         | pre-configured password. You can also pass a class name of a custom implementation.
313         |
314         */
315
316         'authentication' => false,
317
318         // Password for the simple authentication
319         'authentication_password' => 'VerySecretPassword',
320
321         /*
322         |------------------------------------------------------------------------------------------------------------------
323         | Stack traces collection
324         |------------------------------------------------------------------------------------------------------------------
325         |
326         | Clockwork can collect stack traces for log messages and certain data like database queries. Here you can set
327         | whether to collect stack traces, limit the number of collected frames and set further configuration. Collecting
328         | long stack traces considerably increases metadata size.
329         |
330         */
331
332         'stack_traces' => [
333                 // Enable or disable collecting of stack traces
334                 'enabled' => true,
335
336                 // Limit the number of frames to be collected
337                 'limit' => 10,
338
339                 // List of vendor names to skip when determining caller, common vendors are automatically added
340                 'skip_vendors' => [
341                         // 'phpunit'
342                 ],
343
344                 // List of namespaces to skip when determining caller
345                 'skip_namespaces' => [
346                         // 'Laravel'
347                 ],
348
349                 // List of class names to skip when determining caller
350                 'skip_classes' => [
351                         // App\CustomLog::class
352                 ]
353
354         ],
355
356         /*
357         |------------------------------------------------------------------------------------------------------------------
358         | Serialization
359         |------------------------------------------------------------------------------------------------------------------
360         |
361         | Clockwork serializes the collected data to json for storage and transfer. Here you can configure certain aspects
362         | of serialization. Serialization has a large effect on the cpu time and memory usage.
363         |
364         */
365
366         // Maximum depth of serialized multi-level arrays and objects
367         'serialization_depth' => 10,
368
369         // A list of classes that will never be serialized (eg. a common service container class)
370         'serialization_blackbox' => [
371                 \Illuminate\Container\Container::class,
372                 \Illuminate\Foundation\Application::class,
373         ],
374
375         /*
376         |------------------------------------------------------------------------------------------------------------------
377         | Register helpers
378         |------------------------------------------------------------------------------------------------------------------
379         |
380         | Clockwork comes with a "clock" global helper function. You can use this helper to quickly log something and to
381         | access the Clockwork instance.
382         |
383         */
384
385         'register_helpers' => true,
386
387         /*
388         |------------------------------------------------------------------------------------------------------------------
389         | Send Headers for AJAX request
390         |------------------------------------------------------------------------------------------------------------------
391         |
392         | When trying to collect data the AJAX method can sometimes fail if it is missing required headers. For example, an
393         | API might require a version number using Accept headers to route the HTTP request to the correct codebase.
394         |
395         */
396
397         'headers' => [
398                 // 'Accept' => 'application/vnd.com.whatever.v1+json',
399         ],
400
401         /*
402         |------------------------------------------------------------------------------------------------------------------
403         | Server-Timing
404         |------------------------------------------------------------------------------------------------------------------
405         |
406         | Clockwork supports the W3C Server Timing specification, which allows for collecting a simple performance metrics
407         | in a cross-browser way. Eg. in Chrome, your app, database and timeline event timings will be shown in the Dev
408         | Tools network tab. This setting specifies the max number of timeline events that will be sent. Setting to false
409         | will disable the feature.
410         |
411         */
412
413         'server_timing' => 10
414
415 ];