| 199 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
return [
|
|
|
4 |
|
|
|
5 |
/*
|
|
|
6 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
7 |
| Enable Clockwork
|
|
|
8 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
9 |
|
|
|
|
10 |
| You can explicitly enable or disable Clockwork here. When disabled,
|
|
|
11 |
| the storeRequest and returnRequest methods will be no-ops. This provides
|
|
|
12 |
| a convenient way to disable Clockwork in production.
|
|
|
13 |
|
|
|
|
14 |
*/
|
|
|
15 |
|
|
|
16 |
'enable' => isset($_ENV['CLOCKWORK_ENABLE']) ? $_ENV['CLOCKWORK_ENABLE'] : true,
|
|
|
17 |
|
|
|
18 |
/*
|
|
|
19 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
20 |
| Features
|
|
|
21 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
22 |
|
|
|
|
23 |
| You can enable or disable various Clockwork features here. Some features have additional settings (eg. slow query
|
|
|
24 |
| threshold for database queries).
|
|
|
25 |
|
|
|
|
26 |
*/
|
|
|
27 |
|
|
|
28 |
'features' => [
|
|
|
29 |
|
|
|
30 |
// Performance metrics
|
|
|
31 |
'performance' => [
|
|
|
32 |
// Allow collecting of client metrics. Requires separate clockwork-browser npm package.
|
|
|
33 |
'client_metrics' => isset($_ENV['CLOCKWORK_PERFORMANCE_CLIENT_METRICS']) ? $_ENV['CLOCKWORK_PERFORMANCE_CLIENT_METRICS'] : true
|
|
|
34 |
]
|
|
|
35 |
|
|
|
36 |
],
|
|
|
37 |
|
|
|
38 |
/*
|
|
|
39 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
40 |
| Enable toolbar
|
|
|
41 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
42 |
|
|
|
|
43 |
| Clockwork can show a toolbar with basic metrics on all responses. Here you can enable or disable this feature.
|
|
|
44 |
| Requires a separate clockwork-browser npm library.
|
|
|
45 |
|
|
|
|
46 |
*/
|
|
|
47 |
|
|
|
48 |
'toolbar' => isset($_ENV['CLOCKWORK_TOOLBAR']) ? $_ENV['CLOCKWORK_TOOLBAR'] : true,
|
|
|
49 |
|
|
|
50 |
/*
|
|
|
51 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
52 |
| HTTP requests collection
|
|
|
53 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
54 |
|
|
|
|
55 |
| Clockwork collects data about HTTP requests to your app. Here you can choose which requests should be collected.
|
|
|
56 |
|
|
|
|
57 |
*/
|
|
|
58 |
|
|
|
59 |
'requests' => [
|
|
|
60 |
// With on-demand mode enabled, Clockwork will only profile requests when the browser extension is open or you
|
|
|
61 |
// manually pass a "clockwork-profile" cookie or get/post data key.
|
|
|
62 |
// Optionally you can specify a "secret" that has to be passed as the value to enable profiling.
|
|
|
63 |
'on_demand' => isset($_ENV['CLOCKWORK_REQUESTS_ON_DEMAND']) ? $_ENV['CLOCKWORK_REQUESTS_ON_DEMAND'] : false,
|
|
|
64 |
|
|
|
65 |
// Collect only errors (requests with HTTP 4xx and 5xx responses)
|
|
|
66 |
'errors_only' => isset($_ENV['CLOCKWORK_REQUESTS_ERRORS_ONLY']) ? $_ENV['CLOCKWORK_REQUESTS_ERRORS_ONLY'] : false,
|
|
|
67 |
|
|
|
68 |
// Response time threshold in milliseconds after which the request will be marked as slow
|
|
|
69 |
'slow_threshold' => isset($_ENV['CLOCKWORK_REQUESTS_SLOW_THRESHOLD']) ? $_ENV['CLOCKWORK_REQUESTS_SLOW_THRESHOLD'] : null,
|
|
|
70 |
|
|
|
71 |
// Collect only slow requests
|
|
|
72 |
'slow_only' => isset($_ENV['CLOCKWORK_REQUESTS_SLOW_ONLY']) ? $_ENV['CLOCKWORK_REQUESTS_SLOW_ONLY'] : false,
|
|
|
73 |
|
|
|
74 |
// Sample the collected requests (eg. set to 100 to collect only 1 in 100 requests)
|
|
|
75 |
'sample' => isset($_ENV['CLOCKWORK_REQUESTS_SAMPLE']) ? $_ENV['CLOCKWORK_REQUESTS_SAMPLE'] : false,
|
|
|
76 |
|
|
|
77 |
// List of URIs that should not be collected
|
|
|
78 |
'except' => [
|
|
|
79 |
// '/api/.*'
|
|
|
80 |
],
|
|
|
81 |
|
|
|
82 |
// List of URIs that should be collected, any other URI will not be collected if not empty
|
|
|
83 |
'only' => [
|
|
|
84 |
// '/api/.*'
|
|
|
85 |
],
|
|
|
86 |
|
|
|
87 |
// Don't collect OPTIONS requests, mostly used in the CSRF pre-flight requests and are rarely of interest
|
|
|
88 |
'except_preflight' => isset($_ENV['CLOCKWORK_REQUESTS_EXCEPT_PREFLIGHT']) ? $_ENV['CLOCKWORK_REQUESTS_EXCEPT_PREFLIGHT'] : true
|
|
|
89 |
],
|
|
|
90 |
|
|
|
91 |
/*
|
|
|
92 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
93 |
| Enable data collection when Clockwork is disabled
|
|
|
94 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
95 |
|
|
|
|
96 |
| You can enable this setting to collect data even when Clockwork is disabled. Eg. for future analysis.
|
|
|
97 |
|
|
|
|
98 |
*/
|
|
|
99 |
|
|
|
100 |
'collect_data_always' => isset($_ENV['CLOCKWORK_COLLECT_DATA_ALWAYS']) ? $_ENV['CLOCKWORK_COLLECT_DATA_ALWAYS'] : false,
|
|
|
101 |
|
|
|
102 |
/*
|
|
|
103 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
104 |
| Clockwork API URI
|
|
|
105 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
106 |
|
|
|
|
107 |
| Path of the script calling returnRequest to return Clockwork metadata to the client app. See installation
|
|
|
108 |
| instructions for details.
|
|
|
109 |
|
|
|
|
110 |
*/
|
|
|
111 |
|
|
|
112 |
'api' => isset($_ENV['CLOCKWORK_API']) ? $_ENV['CLOCKWORK_API'] : '/__clockwork/',
|
|
|
113 |
|
|
|
114 |
/*
|
|
|
115 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
116 |
| Clockwork web UI
|
|
|
117 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
118 |
|
|
|
|
119 |
| Clockwork comes bundled with a full Clockwork App accessible as a Web UI. Here you can enable and configure this
|
|
|
120 |
| feature.
|
|
|
121 |
| Clockwork::returnWeb api is used to expose the Web UI in your vanilla app, see the installation instructions for
|
|
|
122 |
| details.
|
|
|
123 |
|
|
|
|
124 |
*/
|
|
|
125 |
|
|
|
126 |
'web' => [
|
|
|
127 |
// Enable or disable the Web UI, set to the public uri where Clockwork Web UI is accessible
|
|
|
128 |
'enable' => isset($_ENV['CLOCKWORK_WEB_ENABLE']) ? $_ENV['CLOCKWORK_WEB_ENABLE'] : true,
|
|
|
129 |
|
|
|
130 |
// Path where to install the Web UI assets, should be publicly accessible
|
|
|
131 |
'path' => isset($_ENV['CLOCKWORK_WEB_PATH']) ? $_ENV['CLOCKWORK_WEB_PATH'] : __DIR__ . '/../../../../../public/vendor/clockwork',
|
|
|
132 |
|
|
|
133 |
// Public URI where the installed Web UI assets will be accessible
|
|
|
134 |
'uri' => isset($_ENV['CLOCKWORK_WEB_URI']) ? $_ENV['CLOCKWORK_WEB_URI'] : '/vendor/clockwork'
|
|
|
135 |
],
|
|
|
136 |
|
|
|
137 |
/*
|
|
|
138 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
139 |
| Metadata storage
|
|
|
140 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
141 |
|
|
|
|
142 |
| Configure how is the metadata collected by Clockwork stored. Two options are available:
|
|
|
143 |
| - files - A simple fast storage implementation storing data in one-per-request files.
|
|
|
144 |
| - sql - Stores requests in a sql database. Supports MySQL, Postgresql, Sqlite and requires PDO.
|
|
|
145 |
|
|
|
|
146 |
*/
|
|
|
147 |
|
|
|
148 |
'storage' => isset($_ENV['CLOCKWORK_STORAGE']) ? $_ENV['CLOCKWORK_STORAGE'] : 'files',
|
|
|
149 |
|
|
|
150 |
// Path where the Clockwork metadata is stored
|
|
|
151 |
'storage_files_path' => isset($_ENV['CLOCKWORK_STORAGE_FILES_PATH']) ? $_ENV['CLOCKWORK_STORAGE_FILES_PATH'] : __DIR__ . '/../../../../../../clockwork',
|
|
|
152 |
|
|
|
153 |
// Compress the metadata files using gzip, trading a little bit of performance for lower disk usage
|
|
|
154 |
'storage_files_compress' => isset($_ENV['CLOCKWORK_STORAGE_FILES_COMPRESS']) ? $_ENV['CLOCKWORK_STORAGE_FILES_COMPRESS'] : false,
|
|
|
155 |
|
|
|
156 |
// SQL database to use, can be a PDO connection string or a path to a sqlite file
|
|
|
157 |
'storage_sql_database' => isset($_ENV['CLOCKWORK_STORAGE_SQL_DATABASE']) ? $_ENV['CLOCKWORK_STORAGE_SQL_DATABASE'] : 'sqlite:' . __DIR__ . '/../../../../../clockwork.sqlite',
|
|
|
158 |
'storage_sql_username' => isset($_ENV['CLOCKWORK_STORAGE_SQL_USERNAME']) ? $_ENV['CLOCKWORK_STORAGE_SQL_USERNAME'] : null,
|
|
|
159 |
'storage_sql_password' => isset($_ENV['CLOCKWORK_STORAGE_SQL_PASSWORD']) ? $_ENV['CLOCKWORK_STORAGE_SQL_PASSWORD'] : null,
|
|
|
160 |
|
|
|
161 |
// SQL table name to use, the table is automatically created and updated when needed
|
|
|
162 |
'storage_sql_table' => isset($_ENV['CLOCKWORK_STORAGE_SQL_TABLE']) ? $_ENV['CLOCKWORK_STORAGE_SQL_TABLE'] : 'clockwork',
|
|
|
163 |
|
|
|
164 |
// Maximum lifetime of collected metadata in minutes, older requests will automatically be deleted, false to disable
|
|
|
165 |
'storage_expiration' => isset($_ENV['CLOCKWORK_STORAGE_EXPIRATION']) ? $_ENV['CLOCKWORK_STORAGE_EXPIRATION'] : 60 * 24 * 7,
|
|
|
166 |
|
|
|
167 |
/*
|
|
|
168 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
169 |
| Authentication
|
|
|
170 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
171 |
|
|
|
|
172 |
| Clockwork can be configured to require authentication before allowing access to the collected data. This might be
|
|
|
173 |
| useful when the application is publicly accessible. Setting to true will enable a simple authentication with a
|
|
|
174 |
| pre-configured password. You can also pass a class name of a custom implementation.
|
|
|
175 |
|
|
|
|
176 |
*/
|
|
|
177 |
|
|
|
178 |
'authentication' => isset($_ENV['CLOCKWORK_AUTHENTICATION']) ? $_ENV['CLOCKWORK_AUTHENTICATION'] : false,
|
|
|
179 |
|
|
|
180 |
// Password for the simple authentication
|
|
|
181 |
'authentication_password' => isset($_ENV['CLOCKWORK_AUTHENTICATION_PASSWORD']) ? $_ENV['CLOCKWORK_AUTHENTICATION_PASSWORD'] : 'VerySecretPassword',
|
|
|
182 |
|
|
|
183 |
/*
|
|
|
184 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
185 |
| Stack traces collection
|
|
|
186 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
187 |
|
|
|
|
188 |
| Clockwork can collect stack traces for log messages and certain data like database queries. Here you can set
|
|
|
189 |
| whether to collect stack traces, limit the number of collected frames and set further configuration. Collecting
|
|
|
190 |
| long stack traces considerably increases metadata size.
|
|
|
191 |
|
|
|
|
192 |
*/
|
|
|
193 |
|
|
|
194 |
'stack_traces' => [
|
|
|
195 |
// Enable or disable collecting of stack traces
|
|
|
196 |
'enabled' => isset($_ENV['CLOCKWORK_STACK_TRACES_ENABLED']) ? $_ENV['CLOCKWORK_STACK_TRACES_ENABLED'] : true,
|
|
|
197 |
|
|
|
198 |
// Limit the number of frames to be collected
|
|
|
199 |
'limit' => isset($_ENV['CLOCKWORK_STACK_TRACES_LIMIT']) ? $_ENV['CLOCKWORK_STACK_TRACES_LIMIT'] : 10,
|
|
|
200 |
|
|
|
201 |
// List of vendor names to skip when determining caller, common vendor are automatically added
|
|
|
202 |
'skip_vendors' => [
|
|
|
203 |
// 'phpunit'
|
|
|
204 |
],
|
|
|
205 |
|
|
|
206 |
// List of namespaces to skip when determining caller
|
|
|
207 |
'skip_namespaces' => [
|
|
|
208 |
// 'Vendor'
|
|
|
209 |
],
|
|
|
210 |
|
|
|
211 |
// List of class names to skip when determining caller
|
|
|
212 |
'skip_classes' => [
|
|
|
213 |
// App\CustomLog::class
|
|
|
214 |
]
|
|
|
215 |
],
|
|
|
216 |
|
|
|
217 |
/*
|
|
|
218 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
219 |
| Serialization
|
|
|
220 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
221 |
|
|
|
|
222 |
| Clockwork serializes the collected data to json for storage and transfer. Here you can configure certain aspects
|
|
|
223 |
| of serialization. Serialization has a large effect on the cpu time and memory usage.
|
|
|
224 |
|
|
|
|
225 |
*/
|
|
|
226 |
|
|
|
227 |
// Maximum depth of serialized multi-level arrays and objects
|
|
|
228 |
'serialization_depth' => isset($_ENV['CLOCKWORK_SERIALIZATION_DEPTH']) ? $_ENV['CLOCKWORK_SERIALIZATION_DEPTH'] : 10,
|
|
|
229 |
|
|
|
230 |
// A list of classes that will never be serialized (eg. a common service container class)
|
|
|
231 |
'serialization_blackbox' => [
|
|
|
232 |
// \App\ServiceContainer::class
|
|
|
233 |
],
|
|
|
234 |
|
|
|
235 |
/*
|
|
|
236 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
237 |
| Register helpers
|
|
|
238 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
239 |
|
|
|
|
240 |
| Clockwork comes with a "clock" global helper function. You can use this helper to quickly log something and to
|
|
|
241 |
| access the Clockwork instance.
|
|
|
242 |
|
|
|
|
243 |
*/
|
|
|
244 |
|
|
|
245 |
'register_helpers' => isset($_ENV['CLOCKWORK_REGISTER_HELPERS']) ? $_ENV['CLOCKWORK_REGISTER_HELPERS'] : false,
|
|
|
246 |
|
|
|
247 |
/*
|
|
|
248 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
249 |
| Send Headers for AJAX request
|
|
|
250 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
251 |
|
|
|
|
252 |
| When trying to collect data the AJAX method can sometimes fail if it is missing required headers. For example, an
|
|
|
253 |
| API might require a version number using Accept headers to route the HTTP request to the correct codebase.
|
|
|
254 |
|
|
|
|
255 |
*/
|
|
|
256 |
|
|
|
257 |
'headers' => [
|
|
|
258 |
// 'Accept' => 'application/vnd.com.whatever.v1+json',
|
|
|
259 |
],
|
|
|
260 |
/*
|
|
|
261 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
262 |
| Server-Timing
|
|
|
263 |
|------------------------------------------------------------------------------------------------------------------
|
|
|
264 |
|
|
|
|
265 |
| Clockwork supports the W3C Server Timing specification, which allows for collecting a simple performance metrics
|
|
|
266 |
| in a cross-browser way. Eg. in Chrome, your app, database and timeline event timings will be shown in the Dev
|
|
|
267 |
| Tools network tab. This setting specifies the max number of timeline events that will be sent. Setting to false
|
|
|
268 |
| will disable the feature.
|
|
|
269 |
|
|
|
|
270 |
*/
|
|
|
271 |
|
|
|
272 |
'server_timing' => isset($_ENV['CLOCKWORK_SERVER_TIMING']) ? $_ENV['CLOCKWORK_SERVER_TIMING'] : 10
|
|
|
273 |
|
|
|
274 |
];
|