Laravel
Bugtail works with the official Sentry SDK for Laravel. Errors, log lines and traces all go through the same package and the same DSN.
Install
composer require sentry/sentry-laravel
The package registers itself; there is nothing to add to config/app.php.
Configure
Add the DSN of your collector to .env. You find it under Settings > Projects and collectors, or in Get started.
SENTRY_LARAVEL_DSN=https://<key>@ingest.bugtail.eu/<project-id>
SENTRY_TRACES_SAMPLE_RATE=0.2
Then hand your exceptions to the SDK in bootstrap/app.php:
use Sentry\Laravel\Integration;
->withExceptions(function (Exceptions $exceptions): void {
Integration::handles($exceptions);
})
Send a test event
php artisan sentry:test
The command sends one event and prints the answer. It shows up under Issues within seconds.
Logs
To send your log lines to Bugtail as well, turn on logs in the SDK and add its channel to your log stack:
SENTRY_ENABLE_LOGS=true
LOG_CHANNEL=stack
LOG_STACK=single,sentry_logs
Lines at LOG_LEVEL and above are sent. Set SENTRY_LOG_LEVEL=warning to send fewer. They appear under Logs.
Tracing
SENTRY_TRACES_SAMPLE_RATE is the share of requests and queued jobs the SDK traces: 0.2 traces one in five, 1.0 traces everything. Database queries, views, cache calls and outgoing HTTP calls show up as spans inside them.
Every trace that arrives is counted in the latency figures under Performance. Which traces are also kept in full, so you can open them, is a setting on the collector: see Tracing.
Releases and environments
Tag your events with the version you deploy, so Bugtail can tell you which release an issue first appeared in:
SENTRY_RELEASE=1.4.0
SENTRY_ENVIRONMENT=production
When SENTRY_ENVIRONMENT is not set, the SDK uses your APP_ENV. See Releases for what a release unlocks.