Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(php): Adjust docs for Laravel DS #5601

Merged
merged 9 commits into from Oct 19, 2022
1 change: 1 addition & 0 deletions src/includes/sampling-supported-sdks.mdx
Expand Up @@ -5,6 +5,7 @@
- React Native: 4.3.0 or later
- Dart and Flutter: 6.11.0 or later
- PHP: 3.9.0 or later
- Laravel: 3.0.0 or later
- Ruby: 5.5.0 or later
- Java: 6.5.0-beta.2 or later
- .NET: 3.22.0 or later
Expand Up @@ -4,17 +4,18 @@ sidebar_order: 40
description: "Learn how to connect backend and frontend transactions."
---

If you are also using Performance Monitoring for [JavaScript](/platforms/javascript/performance/) you can use a helper function to continue the trace started from your backend in order to [connect services](/platforms/javascript/performance/connect-services/#navigation-and-other-xhr-requests).
If you're also using Performance Monitoring for [JavaScript](/platforms/javascript/performance/), you can use a helper function to continue the trace and propagate the Dynamic Sampling context started from your backend in order to [connect services](/platforms/javascript/performance/connect-services/#navigation-and-other-xhr-requests). (The Dynamic Sampling 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:

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

This helper function will render a meta tag similar to this `<meta name="sentry-trace" content="49879feb76c84743ba5034bd2d3f1ca3-7cb5535c930d4666-1"/>`, which our JavaScript SDK will pick up and continue the trace. Therefore, your frontend and your backend are connected by way of the same trace.
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 Dynamic Sampling 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.