The SENTRY_DSN to use on your own machine
For local development, use SENTRY_DSN=http://sentry@127.0.0.1:8000/1 with Buggregator running on your machine. The same DSN works in the Sentry SDKs for PHP, JavaScript, Python and Go. Errors then land in the Buggregator UI on port 8000, not in a Sentry account. To keep apps apart, name the project in the DSN: http://sentry@127.0.0.1:8000/shop in PHP, or http://shop@127.0.0.1:8000/1 in SDKs that accept only a number at the end.
Steps
1. Start Buggregator
Errors arrive on the HTTP port 8000, the same port as the UI.
docker run --pull always \
-p 127.0.0.1:8000:8000 \
ghcr.io/buggregator/server:latest2. Set the DSN in your app
The key before @ can be any word, and the 1 at the end can be any number. Laravel reads its own variable name.
# PHP, Symfony, Spiral, Node.js, Python, Go
SENTRY_DSN=http://sentry@127.0.0.1:8000/1
# Laravel
SENTRY_LARAVEL_DSN=http://sentry@127.0.0.1:8000/1When the app runs in Docker Compose next to Buggregator, replace 127.0.0.1 with the service name, for example http://sentry@buggregator:8000/1. For traces, also set the SDK's trace sample rate to 1.0, or traces are sampled away.
3. Name the project, PHP SDK
With the Sentry PHP SDK, put the project key at the end instead of the number. A new key creates the project with its first error.
SENTRY_DSN=http://sentry@127.0.0.1:8000/shop4. Name the project, JavaScript and Python SDKs
These SDKs refuse a name at the end of the DSN. Keep the number and put the project key before @. The project must exist first, so list it in buggregator.yaml, the config file of Buggregator itself:
projects:
- key: billing
name: Billing
- key: storefront
name: Storefront# PHP backend
SENTRY_DSN=http://billing@127.0.0.1:8000/1
# JavaScript frontend
SENTRY_DSN=http://storefront@127.0.0.1:8000/1The JavaScript SDK takes only letters, digits and _ before @. Write store_front and Buggregator finds the project store-front.
5. Open the Sentry page
Throw an error in your app and open http://127.0.0.1:8000, then Sentry. Pick the project in the sidebar to see only its errors, traces and logs.
Why it works
Buggregator accepts the Sentry SDK protocol on port 8000. It reads the project from the DSN path first, then from the X-Buggregator-Event: sentry and X-Buggregator-Project headers sent together, then from the key before @ if a project with that key exists. Without any of them, the event goes to the default project. A number at the end is the SDK's own project id, so it never picks a Buggregator project. The key sentry never does either.
Docs: docs.buggregator.dev/config/sentry.html#projects
Requires Buggregator v2.11.0+
Related tips
- Sentry
One Buggregator for all your apps, each in its own project
Give each service its own project key in the Sentry DSN path, the SMTP user name or the profiler URL. One Buggregator keeps their errors and mail apart.
- Sentry
Laravel errors in Sentry's UI style, no Sentry account
Set SENTRY_LARAVEL_DSN to Buggregator. Each Laravel exception shows locally with its stack trace, request and breadcrumbs. No account, no limits.
- Sentry
Python script errors with sentry-sdk, on your machine
Init sentry-sdk with a DSN that points at Buggregator. Crashes and caught errors of your scripts and workers show up in a local UI, with their logs.
- Sentry
Sentry for local dev without self-hosting Sentry
Run one Buggregator container and point your Sentry DSN at it. Your app keeps the same Sentry SDK; errors, traces and logs show up on your machine.
Checked on with Buggregator v2.13.0