|
1 | | - |
2 | 1 | Distributed tracing will be set up automatically if you've <PlatformLink to="/tracing/">set up tracing</PlatformLink>. |
3 | 2 |
|
| 3 | +<Expandable title="What is Distributed Tracing?"> |
| 4 | + <PlatformContent includePath="distributed-tracing/explanation" /> |
| 5 | +</Expandable> |
| 6 | + |
4 | 7 | When tracing is enabled, the Sentry SDK will not only create spans for pageloads and transactions but also propagate trace information to other systems. This allows you to connect multiple systems and see how they interact with each other. |
5 | 8 |
|
6 | | -If you have not enabled tracing, or you need to propagate traces in places other than outgoing HTTP requests (e.g. when working with websockers), you can manually set up your application for distributed tracing to work. |
| 9 | +By default, outgoing HTTP requests will automatically be instrumented for you. For other cases where you may want to continue traces (for example when working with websockets), you can manually extract and inject tracing information. |
7 | 10 |
|
8 | 11 | ## Enabling Automatic Distributed Tracing |
9 | 12 |
|
10 | 13 | To enable distributed tracing for your frontend, add `browserTracingIntegration` to your `Sentry.init()` options as described in the <PlatformLink to="/tracing/instrumentation/automatic-instrumentation/">Automatic Instrumentation</PlatformLink> docs. |
11 | 14 |
|
12 | | -If you want to use distributed tracing without creating spans, set the `tracesSampleRate` option to `0`. |
13 | | - |
14 | | -```javascript |
15 | | -Sentry.init({ |
16 | | - dsn: "___PUBLIC_DSN___", |
17 | | - integrations: [Sentry.browserTracingIntegration()], |
18 | | - |
19 | | - // If this is 0, tracing is disabled |
20 | | - // but distributed tracing is not |
21 | | - tracesSampleRate: 0, |
22 | | -}); |
23 | | -``` |
24 | | - |
25 | 15 | ### Continuing a Trace Manually |
26 | 16 |
|
27 | 17 | By default, the `browserTracingIntegration` will automatically continue a trace found in a `<meta>` tag - see <PlatformLink to="/tracing/trace-propagation/#automatic-trace-propagation">Automatic Trace Propagation</PlatformLink> for details. |
@@ -53,7 +43,7 @@ Sentry.startBrowserTracingPageLoadSpan( |
53 | 43 |
|
54 | 44 | ## Configuring Distributed Tracing Without `browserTracingIntegration` |
55 | 45 |
|
56 | | -If you don't want to use the `browserTracingIntegration` integration, you can manually extract and inject tracing data in your application to connect multiple systems. For this, you must: |
| 46 | +If you don't want to use the `browserTracingIntegration` integration, or you want to propagate traces in other places than HTTP requests (for example, with websockets), you can manually extract and inject tracing data in your application to connect multiple systems. For this, you must: |
57 | 47 |
|
58 | 48 | - Extract and store incoming tracing information from HTML `<meta>` tags when loading the page. |
59 | 49 | - Inject tracing information to any outgoing requests. |
|
0 commit comments