]> BookStack Code Mirror - bookstack/blob - app/Config/clockwork.php
Drawings: Added class to extract drawio data from png files
[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             '/uploads/images/.*', // BookStack image requests
177
178             '/horizon/.*', // Laravel Horizon requests
179             '/telescope/.*', // Laravel Telescope requests
180             '/_debugbar/.*', // Laravel DebugBar requests
181         ],
182
183         // List of URIs that should be collected, any other URI will not be collected if not empty
184         'only' => [
185             // '/api/.*'
186         ],
187
188         // Don't collect OPTIONS requests, mostly used in the CSRF pre-flight requests and are rarely of interest
189         'except_preflight' => true,
190     ],
191
192     /*
193     |------------------------------------------------------------------------------------------------------------------
194     | Artisan commands collection
195     |------------------------------------------------------------------------------------------------------------------
196     |
197     | Clockwork can collect data about executed artisan commands. Here you can enable and configure which commands
198     | should be collected.
199     |
200     */
201
202     'artisan' => [
203         // Enable or disable collection of executed Artisan commands
204         'collect' => false,
205
206         // List of commands that should not be collected (built-in commands are not collected by default)
207         'except' => [
208             // 'inspire'
209         ],
210
211         // List of commands that should be collected, any other command will not be collected if not empty
212         'only' => [
213             // 'inspire'
214         ],
215
216         // Enable or disable collection of command output
217         'collect_output' => false,
218
219         // Enable or disable collection of built-in Laravel commands
220         'except_laravel_commands' => true,
221     ],
222
223     /*
224     |------------------------------------------------------------------------------------------------------------------
225     | Queue jobs collection
226     |------------------------------------------------------------------------------------------------------------------
227     |
228     | Clockwork can collect data about executed queue jobs. Here you can enable and configure which queue jobs should
229     | be collected.
230     |
231     */
232
233     'queue' => [
234         // Enable or disable collection of executed queue jobs
235         'collect' => false,
236
237         // List of queue jobs that should not be collected
238         'except' => [
239             // App\Jobs\ExpensiveJob::class
240         ],
241
242         // List of queue jobs that should be collected, any other queue job will not be collected if not empty
243         'only' => [
244             // App\Jobs\BuggyJob::class
245         ],
246     ],
247
248     /*
249     |------------------------------------------------------------------------------------------------------------------
250     | Tests collection
251     |------------------------------------------------------------------------------------------------------------------
252     |
253     | Clockwork can collect data about executed tests. Here you can enable and configure which tests should be
254     | collected.
255     |
256     */
257
258     'tests' => [
259         // Enable or disable collection of ran tests
260         'collect' => false,
261
262         // List of tests that should not be collected
263         'except' => [
264             // Tests\Unit\ExampleTest::class
265         ],
266     ],
267
268     /*
269     |------------------------------------------------------------------------------------------------------------------
270     | Enable data collection when Clockwork is disabled
271     |------------------------------------------------------------------------------------------------------------------
272     |
273     | You can enable this setting to collect data even when Clockwork is disabled. Eg. for future analysis.
274     |
275     */
276
277     'collect_data_always' => false,
278
279     /*
280     |------------------------------------------------------------------------------------------------------------------
281     | Metadata storage
282     |------------------------------------------------------------------------------------------------------------------
283     |
284     | Configure how is the metadata collected by Clockwork stored. Two options are available:
285     |   - files - A simple fast storage implementation storing data in one-per-request files.
286     |   - sql - Stores requests in a sql database. Supports MySQL, Postgresql, Sqlite and requires PDO.
287     |
288     */
289
290     'storage' => 'files',
291
292     // Path where the Clockwork metadata is stored
293     'storage_files_path' => storage_path('clockwork'),
294
295     // Compress the metadata files using gzip, trading a little bit of performance for lower disk usage
296     'storage_files_compress' => false,
297
298     // SQL database to use, can be a name of database configured in database.php or a path to a sqlite file
299     'storage_sql_database' => storage_path('clockwork.sqlite'),
300
301     // SQL table name to use, the table is automatically created and udpated when needed
302     'storage_sql_table' => 'clockwork',
303
304     // Maximum lifetime of collected metadata in minutes, older requests will automatically be deleted, false to disable
305     'storage_expiration' => 60 * 24 * 7,
306
307     /*
308     |------------------------------------------------------------------------------------------------------------------
309     | Authentication
310     |------------------------------------------------------------------------------------------------------------------
311     |
312     | Clockwork can be configured to require authentication before allowing access to the collected data. This might be
313     | useful when the application is publicly accessible. Setting to true will enable a simple authentication with a
314     | pre-configured password. You can also pass a class name of a custom implementation.
315     |
316     */
317
318     'authentication' => false,
319
320     // Password for the simple authentication
321     'authentication_password' => 'VerySecretPassword',
322
323     /*
324     |------------------------------------------------------------------------------------------------------------------
325     | Stack traces collection
326     |------------------------------------------------------------------------------------------------------------------
327     |
328     | Clockwork can collect stack traces for log messages and certain data like database queries. Here you can set
329     | whether to collect stack traces, limit the number of collected frames and set further configuration. Collecting
330     | long stack traces considerably increases metadata size.
331     |
332     */
333
334     'stack_traces' => [
335         // Enable or disable collecting of stack traces
336         'enabled' => true,
337
338         // Limit the number of frames to be collected
339         'limit' => 10,
340
341         // List of vendor names to skip when determining caller, common vendors are automatically added
342         'skip_vendors' => [
343             // 'phpunit'
344         ],
345
346         // List of namespaces to skip when determining caller
347         'skip_namespaces' => [
348             // 'Laravel'
349         ],
350
351         // List of class names to skip when determining caller
352         'skip_classes' => [
353             // App\CustomLog::class
354         ],
355
356     ],
357
358     /*
359     |------------------------------------------------------------------------------------------------------------------
360     | Serialization
361     |------------------------------------------------------------------------------------------------------------------
362     |
363     | Clockwork serializes the collected data to json for storage and transfer. Here you can configure certain aspects
364     | of serialization. Serialization has a large effect on the cpu time and memory usage.
365     |
366     */
367
368     // Maximum depth of serialized multi-level arrays and objects
369     'serialization_depth' => 10,
370
371     // A list of classes that will never be serialized (eg. a common service container class)
372     'serialization_blackbox' => [
373         \Illuminate\Container\Container::class,
374         \Illuminate\Foundation\Application::class,
375     ],
376
377     /*
378     |------------------------------------------------------------------------------------------------------------------
379     | Register helpers
380     |------------------------------------------------------------------------------------------------------------------
381     |
382     | Clockwork comes with a "clock" global helper function. You can use this helper to quickly log something and to
383     | access the Clockwork instance.
384     |
385     */
386
387     'register_helpers' => true,
388
389     /*
390     |------------------------------------------------------------------------------------------------------------------
391     | Send Headers for AJAX request
392     |------------------------------------------------------------------------------------------------------------------
393     |
394     | When trying to collect data the AJAX method can sometimes fail if it is missing required headers. For example, an
395     | API might require a version number using Accept headers to route the HTTP request to the correct codebase.
396     |
397     */
398
399     'headers' => [
400         // 'Accept' => 'application/vnd.com.whatever.v1+json',
401     ],
402
403     /*
404     |------------------------------------------------------------------------------------------------------------------
405     | Server-Timing
406     |------------------------------------------------------------------------------------------------------------------
407     |
408     | Clockwork supports the W3C Server Timing specification, which allows for collecting a simple performance metrics
409     | in a cross-browser way. Eg. in Chrome, your app, database and timeline event timings will be shown in the Dev
410     | Tools network tab. This setting specifies the max number of timeline events that will be sent. Setting to false
411     | will disable the feature.
412     |
413     */
414
415     'server_timing' => 10,
416
417 ];