Skip to content

Commit f94714c

Browse files
committed
some adjustments
1 parent 7c6e5ed commit f94714c

File tree

4 files changed

+14
-31
lines changed

4 files changed

+14
-31
lines changed

docs/platforms/javascript/common/tracing/trace-propagation/index.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ If the overall application landscape that you want to observe with Sentry consis
1010

1111
## What is Distributed Tracing?
1212

13-
In the context of tracing events across a distributed system, distributed tracing acts as a powerful debugging tool. Imagine your application as a vast network of interconnected parts. For example, your system might be spread across different servers or your application might split into different backend and frontend services, each potentially having their own technology stack.
14-
15-
When an error or performance issue occurs, it can be challenging to pinpoint the root cause due to the complexity of such a system. Distributed tracing helps you follow the path of an event as it travels through this intricate web, recording every step it takes. By examining these traces, you can reconstruct the sequence of events leading up to the event of interest, identify the specific components involved, and understand their interactions. This detailed visibility enables you to diagnose and resolve issues more effectively, ultimately improving the reliability and performance of your distributed system.
13+
<PlatformContent includePath="distributed-tracing/explanation" />
1614

1715
## Basic Example
1816

platform-includes/distributed-tracing/custom-instrumentation/browser/javascript.mdx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1-
21
Distributed tracing will be set up automatically if you've <PlatformLink to="/tracing/">set up tracing</PlatformLink>.
32

3+
<Expandable title="What is Distributed Tracing?">
4+
<PlatformContent includePath="distributed-tracing/explanation" />
5+
</Expandable>
6+
47
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.
58

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.
710

811
## Enabling Automatic Distributed Tracing
912

1013
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.
1114

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-
2515
### Continuing a Trace Manually
2616

2717
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(
5343

5444
## Configuring Distributed Tracing Without `browserTracingIntegration`
5545

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:
5747

5848
- Extract and store incoming tracing information from HTML `<meta>` tags when loading the page.
5949
- Inject tracing information to any outgoing requests.

platform-includes/distributed-tracing/custom-instrumentation/server/javascript.mdx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
Trace propagation is set up automatically in this SDK. By default, outgoing HTTP requests will automatically be instrumented for you.
2-
For other cases where you may want to continue traces (for example, in a job queue or when working with web sockets), you can manually extract and inject tracing information.
2+
For other cases where you may want to continue traces (for example, in a job queue or when working with websockets), you can manually extract and inject tracing information.
33

4-
If you want to use distributed tracing without creating spans, set the `tracesSampleRate` option to `0`.
5-
6-
```javascript
7-
Sentry.init({
8-
dsn: "___PUBLIC_DSN___",
9-
10-
// If this is 0, tracing is disabled
11-
// but distributed tracing is not
12-
tracesSampleRate: 0,
13-
});
14-
```
4+
<Expandable title="What is Distributed Tracing?">
5+
<PlatformContent includePath="distributed-tracing/explanation" />
6+
</Expandable>
157

168
## Manually Extracting and Injecting Distributed Tracing Information
179

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
In the context of tracing events across a distributed system, distributed tracing acts as a powerful debugging tool. Imagine your application as a vast network of interconnected parts. For example, your system might be spread across different servers or your application might split into different backend and frontend services, each potentially having their own technology stack.
2+
3+
When an error or performance issue occurs, it can be challenging to pinpoint the root cause due to the complexity of such a system. Distributed tracing helps you follow the path of an event as it travels through this intricate web, recording every step it takes. By examining these traces, you can reconstruct the sequence of events leading up to the event of interest, identify the specific components involved, and understand their interactions. This detailed visibility enables you to diagnose and resolve issues more effectively, ultimately improving the reliability and performance of your distributed system.

0 commit comments

Comments
 (0)