Distributed Tracing

If you're also using Performance Monitoring for JavaScript, you can use a helper function to continue the trace and propagate the trace context started from your backend in order to enable Distributed Tracing. (The trace context contains additional trace-related data that is used for trace-based sampling.) Add the following line to your blade template rendering the <head/> of your page:

app.blade.php
Copied
<head>
...
{!! \Sentry\Laravel\Integration::sentryMeta() !!}
...
</head>

This helper function will render two meta tags similar to <meta name="sentry-trace" content="49879feb76c84743ba5034bd2d3f1ca3-7cb5535c930d4666-1"/> and <meta name="baggage" content="sentry-trace_id=49879feb76c84743ba5034bd2d3f1ca3,sentry-sample_rate=0.2,sentry-transaction=my-transaction,sentry-public_key=public,sentry-release=1.0.0,sentry-environment=prod>. Our JavaScript SDK will pick these up and then continue the trace and propagate the trace context. As a result, your frontend and your backend are connected by way of the same trace.

Otherwise, other backend services with Performance Monitoring will connect automatically.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").