Laravel
Package for Laravel 10+
The official DockRay package integrates Laravel applications with the monitoring platform, enabling automatic exception reporting and HTTP request performance monitoring. Events are sent directly to the DockRay dashboard along with the information needed to quickly diagnose issues.
Error and Exception Monitoring
DockRay integrates with Laravel’s exception reporting system and automatically sends application errors to a single monitoring dashboard.
Reported events can include:
- the exception type and message,
- where the exception occurred and the stack trace,
- environment and application version information,
- context related to the request being processed.
Selected exception classes can be excluded from reporting. DockRay also respects Laravel’s standard dontReport configuration.
Performance Monitoring
The package can monitor HTTP request processing times for selected middleware groups, such as web and api. Transactions are grouped by route pattern, allowing requests to the same route to be analyzed together regardless of the IDs passed in the URL.
The frequency of transaction data collection can be controlled using a sampling rate.
User Context and Privacy
DockRay can optionally include information about the authenticated user with reported events, such as their ID, email address, and name. Sending the IP address and user agent is controlled by a separate setting and does not need to be enabled by default.
Queues and Artisan Commands
Errors occurring in queues and console processes can also be reported to DockRay. Because they run outside the HTTP middleware stack, they do not generate performance transactions.
Safe Reporting
DockRay’s reporting methods do not throw exceptions, so temporary monitoring platform outages do not interfere with your application’s standard error handling.
Installation
Package Installation
Install DockRay using Composer:
composer require dockcodes/dock-ray-laravel
Then publish the configuration file:
php artisan vendor:publish --tag=ray-config
The Service Provider is automatically discovered by Laravel and does not require manual registration.
Configuration
Add your DockRay project credentials to the .env file:
RAY_TOKEN=project-token
RAY_PRIVATE_KEY=project-private-key
RAY_TRACES_SAMPLE_RATE=0.2
You can find your project token and private key in the DockRay dashboard. If RAY_TOKEN and RAY_PRIVATE_KEY are not set, the package remains inactive and does not send any data.
All other integration settings are available in the config/ray.php file.