-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Simplifying Trace Propagation Examples; Adding origin callout. #13148
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
Changes from 3 commits
ceaaf51
5a00274
cebdcfa
5cc6ae2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,14 @@ If you're using the current version of our SvelteKit SDK, distributed tracing wi | |
|
|
||
| When you are interacting with other external API systems, you might have to define `tracePropagationTargets` to get around possible [Browser CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. | ||
|
|
||
| <Alert> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this 'Alert' block is being used in several places with identical content, it's probably worth creating an include to simplify the maintenance of this content. This can totally be done in a follow-up PR if you want to merge this first.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, definitely. Ill refactor it to include it short term, just to keep things clean, before merging. |
||
|
|
||
| Note: port numbers are relevant for trace propagation and the origin. You may need to configure the `tracePropagationTargets` to ensure that traces are propagated across your services if they run on different ports. | ||
|
|
||
| For example, if you have a Vite frontend running on `http://localhost:5173` and a Bun backend running on `http://localhost:3000`, both `http://localhost:5173` and `http://localhost:3000` should be added to the `tracePropagationTargets` array. | ||
|
|
||
| </Alert> | ||
|
|
||
| ```javascript | ||
| // hooks.client.js | ||
| Sentry.init({ | ||
|
|
@@ -29,18 +37,16 @@ Sentry.init({ | |
| tracePropagationTargets: [ | ||
| "https://api.myecommerce.com", | ||
| "https://auth.myecommerce.com", | ||
| /^\/internal-api\// | ||
| ], | ||
| }); | ||
| ``` | ||
|
|
||
| This tells Sentry to track user journeys across three places: | ||
| This tells Sentry to pass trace headers across the following paths: | ||
|
|
||
| * Your main API server (where product data comes from) | ||
| * Your authentication server (where logins happen) | ||
| * Any API calls that start with "/internal-api/" on your current domain | ||
|
|
||
| This way, if a customer experiences an error during checkout, you can see the complete path their request took across these different services. | ||
| This way, if a customer experiences an error during checkout, or you want to check the performance of a specific endpoint, you can see the complete path their request took across these different services. | ||
|
|
||
| #### Example 2: Mobile App with Backend Services | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this is not correct I believe, you do not need to add your frontend as
traceProapgationTargetsas you'll usually not make API requests to it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup - you're absolutely correct, I have a fix pushed up for this. I kept with the previous examples that had localhost in them - but its not entirely useful or needed. Thanks for catching.