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,3 +5,4 @@
- React Native: 4.3.0 or later
- Dart and Flutter: 6.11.0 or later
- PHP: 3.9.0 or later
- Laravel: 2.15.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).
Add the following line to your blade template rendering the `<head/>` of your page:
If you are also using Performance Monitoring for [JavaScript](/platforms/javascript/performance/) you can use helper functions to continue the trace as well as the Dynamic Sampling Context, which contains additional trace-related data that is used for trace-based sampling, started from your backend in order to [connect services](/platforms/javascript/performance/connect-services/#navigation-and-other-xhr-requests).
cleptric marked this conversation as resolved.
Show resolved Hide resolved
Add the following lines to your blade template rendering the `<head/>` of your page:

```php {filename:app.blade.php}
<head>
...
{!! \Sentry\Laravel\Integration::sentryTracingMeta() !!}
{!! \Sentry\Laravel\Integration::sentryBaggageMeta() !!}
...
</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.
These helper functions 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>, which our JavaScript SDK will pick up and continue the trace and the Dynamic Sampling Context. Therefore, your frontend and your backend are connected by way of the same trace.
cleptric marked this conversation as resolved.
Show resolved Hide resolved

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