Ignore routes
To leave routes out of http.server.request.duration, list them in ignore_routes. Requests to these routes are not recorded.
1. Publish the configuration
Section titled “1. Publish the configuration”php artisan vendor:publish --tag=metrics-config2. List the routes
Section titled “2. List the routes”'ignore_routes' => ['/up', 'horizon.*'],Each pattern matches one of two things:
- A pattern that starts with
/matches the URI template of the route, such as/upor/users/{user}. - Any other pattern matches the route name, such as
horizon.index.
* is a wildcard in both.
Common patterns
Section titled “Common patterns”| To ignore | Pattern |
|---|---|
| Laravel’s health route | '/up' |
| The scrape route of this package | 'metrics.prometheus' |
| Laravel Horizon’s dashboard and API | 'horizon.*' |
| Laravel Telescope | '/telescope*' |
| Laravel Pulse | '/pulse' |
| Every route under a prefix | '/internal/*' |
Check the names and URIs of your routes with php artisan route:list. A route without a name matches only a / pattern.
3. Rebuild the configuration cache
Section titled “3. Rebuild the configuration cache”If the configuration is cached:
php artisan config:cacheWhat is not affected
Section titled “What is not affected”- Only
http.server.request.durationleaves these routes out. Queries, cache operations and exceptions inside an ignored request are still recorded. - A request that matches no route, such as a 404, has no
http.routeand is never ignored.