Skip to content

Commit 94dc924

Browse files
committed
Update README.md
1 parent d485612 commit 94dc924

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,26 @@ Captured metrics are automatically committed when the application terminates. Yo
187187
Metrics::stopCapturing();
188188
```
189189

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+
190210
### Querying Metrics
191211

192212
The `Metric` model includes a powerful query builder with date filtering methods:

0 commit comments

Comments
 (0)