You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,6 +187,26 @@ Captured metrics are automatically committed when the application terminates. Yo
187
187
Metrics::stopCapturing();
188
188
```
189
189
190
+
To enable capturing for your entire application, start capturing in your `AppServiceProvider`:
191
+
192
+
```php
193
+
// app/Providers/AppServiceProvider.php
194
+
195
+
use DirectoryTree\Metrics\Facades\Metrics;
196
+
197
+
class AppServiceProvider extends ServiceProvider
198
+
{
199
+
// ...
200
+
201
+
public function boot(): void
202
+
{
203
+
Metrics::capture();
204
+
}
205
+
}
206
+
```
207
+
208
+
This will batch all metrics recorded during the request and commit them automatically when the application terminates, reducing database queries and improving performance.
209
+
190
210
### Querying Metrics
191
211
192
212
The `Metric` model includes a powerful query builder with date filtering methods:
0 commit comments