Installation
Read
https://docs.sentry.io/performance-monitoring/performance/
to understand the concept behind Tracing/Performance in Sentry.
Make sure you have following in you composer.json
"require": {
"sentry/sentry-laravel": "dev-performance/beta"
},
"minimum-stability": "dev",
"prefer-stable": true,
After that run composer update
.
Make sure the installation of sentry/sentry
, sentry/sdk
and sentry/sentry-laravel
in the output looks something like this:
- Installing sentry/sentry (3.x-dev dd6ef34)
- Installing sentry/sdk (3.x-dev f6b434e)
- Installing sentry/sentry-laravel (dev-performance/beta 745bd72)
The important part is that both sentry/sentry
and sentry/sdk
are 3.x
where sentry/sentry-laravel
is dev-performance/beta
.
After that add 'traces_sample_rate' => 1.0,
to the file in config/sentry.php
.
Note that the value should be larger than 0.0
and smaller or equal than 1.0
(to send everything).
More info can be found here: https://docs.sentry.io/performance-monitoring/getting-started/
Connecting your frontend
To setup tracing for your Vue frontend, follow: https://docs.sentry.io/performance-monitoring/getting-started/?platform=vue
An additional step you should take is, add this to your blade template rendering the <head>
tag {!! Sentry\Laravel\Integration::sentryTracingMeta() !!}
This adds a meta tag similar to <meta name="sentry-trace" content="ae02a316231d490c870b14f27aba8d29-c4a72ffd39444c84-1"/>
to your header and tells the frontend code to pick up the trace.
Known Issues
- Right now we are not using an agent to send those transactions meaning Laravel sends the Transactions after finishing serving the request but the process is only terminated once the Transaction is sent. It shouldn't impact your users a lot but something to keep in mind.
- If you are using on-premise you need to make sure to use the latest release of Sentry https://github.com/getsentry/sentry/releases/tag/20.6.0 or master. Transactions hit a new endpoint and can only be received there.
Papertrail
- [x] Record sql queries as spans
- [x] Record rendered views as spans
- [x] Get route name like
/users/{id}
instead of /users/1
- [x] Start Transaction from incoming headers
- [ ] Collect query span regardless of
sentry.breadcrumbs.sql_queries
option?
This works together with https://github.com/getsentry/sentry-php/pull/1031
Resulting in: