Skip to content

Commit

Permalink
feat(php): Adjust docs for Laravel DS (#5601)
Browse files Browse the repository at this point in the history
  • Loading branch information
cleptric committed Oct 19, 2022
1 parent 431983f commit 8940f56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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 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.

1 comment on commit 8940f56

@vercel
Copy link

@vercel vercel bot commented on 8940f56 Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev

Please sign in to comment.