Skip to content

Commit ec1a1fb

Browse files
committed
respond to PR comments
1 parent 4d2a185 commit ec1a1fb

File tree

9 files changed

+35
-40
lines changed

9 files changed

+35
-40
lines changed

src/components/platformSidebar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ export const PlatformSidebar = ({
8383
<DynamicNav
8484
root={`/${pathRoot}/performance`}
8585
title="Performance Monitoring"
86-
prependLinks={[[`/${pathRoot}/performance/`, "Enabling Tracing"]]}
86+
prependLinks={[
87+
[`/${pathRoot}/performance/`, "Enabling Performance Monitoring"],
88+
]}
8789
suppressMissing
8890
tree={tree}
8991
/>

src/docs/product/performance/distributed-tracing.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ Individual spans aren't sent to Sentry; rather, the entire transaction is sent a
233233

234234
When you enable sampling in your tracing setup, you choose a percentage of collected transactions to send to Sentry. For example, if you had an endpoint that received 1000 requests per minute, a sampling rate of `0.25` would result in approximately 250 transactions (25%) being sent to Sentry each minute. (The number is approximate because each request is either tracked or not, independently and pseudorandomly, with a 25% probability. So in the same way that 100 fair coins, when flipped, result in approximately 50 heads, the SDK will "decide" to collect a trace in approximately 250 cases.) Because you know the sampling percentage, you can then extrapolate your total traffic volume.
235235

236-
When collecting traces, we **strongly recommend** sampling your data, for two reasons. First, though capturing a single trace involves minimal overhead, capturing traces for every single page load, or every single API request, has the potential to add an undesirable amount of load to your system. Second, by enabling sampling you'll more easily prevent yourself from exceeding your organization's [event quota](/accounts/quotas/), which will help you manage costs.
236+
When collecting traces, we recommend sampling your data, for two reasons. First, though capturing a single trace involves minimal overhead, capturing traces for every single page load, or every single API request, has the potential to add an undesirable amount of load to your system. Second, enabling sampling allows you to better manage the number of events sent to Sentry, so you can tailor it to your organization's needs.
237237

238-
When choosing a sampling rate, the goal is to not collect _too_ much data (given the reasons above) but also to collect enough data that you are able to draw meaningful conclusions. If you're not sure what rate to choose, we recommend starting with a low value and gradually increasing it as you learn more about your traffic patterns and volume, until you've found a rate which lets you balance performance and cost concerns with data accuracy.
238+
When choosing a sampling rate, the goal is to not collect _too_ much data (given the reasons above) but also to collect enough data that you are able to draw meaningful conclusions. If you're not sure what rate to choose, we recommend starting with a low value and gradually increasing it as you learn more about your traffic patterns and volume, until you've found a rate which lets you balance performance and volume concerns with data accuracy.
239239

240240
### Consistency Within a Trace
241241

src/includes/performance/default-sampling-context/javascript.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ For browser-based SDKs, it includes the following:
55
{
66
transactionContext: {
77
name: string; // human-readable identifier, like "GET /users"
8-
op: string; // short descriptor of transaction type, like "pageload"
8+
op: string; // short description of transaction type, like "pageload"
99
}
1010
parentSampled: boolean; // if this transaction has a parent, its sampling decision
1111
location: Location | WorkerLocation; // the window.location or self.location object

src/includes/performance/default-sampling-context/node.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The information contained in the `samplingContext` object passed to the `tracesS
44
{
55
transactionContext: {
66
name: string; // human-readable identifier, like "GET /users"
7-
op: string; // short descriptor of transaction type, like "pageload"
7+
op: string; // short description of transaction type, like "pageload"
88
}
99
parentSampled: boolean; // if this transaction has a parent, its sampling decision
1010
request: object // in server contexts, information about the incoming request

src/platforms/common/configuration/filtering.mdx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ notSupported:
66
- perl
77
---
88

9-
There are many reasons you might want to send every possible event to Sentry. While sending all errors ensures you’ll be notified in real-time when problems occur in your code, often applications generate many errors, and thus many notifications. Similarly, while transaction events give you a detailed look into every user's experience (not just those with problems), they also get sent by **every user**, and thus can pile up and eat through your quota very quickly.
9+
Adding Sentry to your app gives you a great deal of very valuable information about errors and performance you wouldn't otherwise get. And lots of information is good -- as long as it's the right information, at a reasonable volume.
1010

11-
To help with those problems, the Sentry SDKs have several configuration options you can use to prevent unwanted events from getting sent to Sentry, as well as ways to send only a representative sample of those you do want.. (The Sentry UI also offers methods to filter events, which you can read more about [here](/product/error-monitoring/filtering/).)
11+
The Sentry SDKs have several configuration options to help you control this, allowing you to both filter out events you don't want and to take a representative sample of those you do.
12+
13+
**Note:**: The Sentry UI also offers methods to filter events, by using [Inbound Filters](/product/error-monitoring/filtering/). We recommend filtering at the client level though, because it removes the overhead of sending events you don't actually want.
1214

1315
## Filtering Error Events
1416

@@ -30,7 +32,7 @@ Typically a `hint` holds the original exception so that additional data can be e
3032

3133
<PlatformContent includePath="configuration/before-send-hint" />
3234

33-
When the SDK creates an event or breadcrumb for transmission, that transmission is typically created from some sort of source object. For instance, an error event is typically created from a log record or exception instance. For better customization, SDKs send these objects to certain callbacks (`before-send``before-breadcrumb` or the event processor system in the SDK).
35+
When the SDK creates an event or breadcrumb for transmission, that transmission is typically created from some sort of source object. For instance, an error event is typically created from a log record or exception instance. For better customization, SDKs send these objects to certain callbacks (`beforeSend``beforeBreadcrumb` or the event processor system in the SDK).
3436

3537
### Using Hints
3638

@@ -89,17 +91,17 @@ To send a representative sample of your errors to Sentry, set the `sampleRate` o
8991

9092
<PlatformContent includePath="configuration/sample-rate" />
9193

92-
<Note><markdown>
93-
94-
The error sample rate is not dynamic; changing it requires re-deployment. In addition, setting an SDK sample rate limits visibility into the source of events. Setting a rate limit for your project (which only drops events when volume is high) may better suit your needs.
95-
96-
</markdown></Note>
94+
**Note:** The error sample rate is not dynamic; changing it requires re-deployment. In addition, setting an SDK sample rate limits visibility into the source of events. Setting a rate limit for your project (which only drops events when volume is high) may better suit your needs.
9795

9896
<PlatformSection supported={["javascript", "node"]}><markdown>
9997

10098
## Filtering Transaction Events
10199

102-
To prevent certain transactions from being reported to Sentry, use the `tracesSampler` configuration option, which allows you to provide a function to evaluate the current transaction and drop it if it's not one you want. (It also allows you to sample different transactions at different rates.) In its simplest form, used just for filtering, it looks like this:
100+
To prevent certain transactions from being reported to Sentry, use the `tracesSampler` configuration option, which allows you to provide a function to evaluate the current transaction and drop it if it's not one you want. (It also allows you to sample different transactions at different rates.)
101+
102+
**Note:** The `tracesSampler` and `tracesSampleRate` config options are mutually exclusive. If you define a `tracesSampler` to filter out certain transactions, you must also handle the case of non-filtered transactions by returning the rate at which you'd like them sampled.
103+
104+
In its simplest form, used just for filtering, it looks like this:
103105

104106
```javascript
105107
tracesSampler: samplingContext => {
@@ -111,20 +113,14 @@ tracesSampler: samplingContext => {
111113
};
112114
```
113115

114-
<Note><markdown>
115-
116-
The `tracesSampler` and `tracesSampleRate` config options are mutually exclusive. If you define a `tracesSampler` in order to filter out certain transactions, you must also handle the case of non-filtered transactions, by returning the rate at which you'd like them sampled.
117-
118-
</markdown></Note>
119-
120116
To learn more about the `tracesSampler` option, please see [Sampling Transactions](/platforms/javascript/performance/sampling/).
121117

122118
</markdown></PlatformSection>
123119

124120
## Sampling Transaction Events
125121

126-
For Sentry's Performance Monitoring, we recommend sampling your data for two reasons. First, though capturing a single trace involves minimal overhead, capturing traces for every single page load, or every single API request, has the potential to add an undesirable amount of load to your system. Second, by enabling sampling you’ll more easily prevent yourself from exceeding your organization’s [event quota](/accounts/quotas/).
122+
For Sentry's Performance Monitoring, we recommend sampling your data for two reasons. First, though capturing a single trace involves minimal overhead, capturing traces for every single page load, or every single API request, has the potential to add an undesirable amount of load to your system. Second, enabling sampling allows you to better manage the number of events sent to Sentry, so you can tailor it to your organization's needs.
127123

128-
When choosing a sampling rate, the goal is not to collect *too* much data, but to collect sufficient data so you can draw meaningful conclusions. If you’re not sure what rate to choose, start with a low value and gradually increase it as you learn more about your traffic patterns and volume, until you’ve found a rate that balances performance and cost concerns with data accuracy.
124+
When choosing a sampling rate, the goal is not to collect *too* much data, but to collect sufficient data so you can draw meaningful conclusions. If you’re not sure what rate to choose, start with a low value and gradually increase it as you learn more about your traffic patterns and volume, until you’ve found a rate that balances performance and volume concerns with data accuracy.
129125

130126
To set a sample rate for your transactions, provide a number between `0` (0% of transactions sent) and `1` (100% of transactions sent) to the `tracesSampleRate` configuration option. For example, including `tracesSampleRate: 0.2` in your SDK config will cause the SDK to only send 20% of possible transaction events.

src/platforms/javascript/common/performance/automatic.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Sentry.init({
118118

119119
### shouldCreateSpanForRequest
120120

121-
This function can be used to filter our unwanted Spans like XHR's running health checks or something similar. By default `shouldCreateSpanForRequest` is already filtering out what was defined in `tracingOrigins`.
121+
This function can be used to filter out unwanted spans such as XHR's running health checks or something similar. By default `shouldCreateSpanForRequest` already filters out everything but what was defined in `tracingOrigins`.
122122

123123
```javascript
124124
import * as Sentry from "@sentry/browser";
@@ -128,11 +128,8 @@ Sentry.init({
128128
integrations: [
129129
new Integrations.BrowserTracing({
130130
shouldCreateSpanForRequest: url => {
131-
// Example of filter out spans that contain `health`
132-
if (url.match(/health/)) {
133-
return false;
134-
}
135-
return true;
131+
// Do not create spans for outgoing requests to a `/health/` endpoint
132+
return !url.match(/\/health\/?$/);
136133
},
137134
}),
138135
],

src/platforms/javascript/common/performance/manual.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ span.finish(); // Remember that only finished spans will be sent with the transa
1616
transaction.finish(); // Finishing the transaction will send it to Sentry
1717
```
1818

19-
Here is a different example. If you want to create a transaction for a user interaction on your page, you need to do the following:
19+
For example, if you want to create a transaction for a user interaction on your page, you can do this:
2020

2121
```javascript
2222
// Let's say this function is invoked when a user clicks on the checkout button of your shop
@@ -45,15 +45,15 @@ shopCheckout() {
4545

4646
This example will send a transaction `shopCheckout` to Sentry. The transaction will contain a `task` span that measures how long `processAndValidateShoppingCart` took. Finally, the call to `transaction.finish()` will finish the transaction and send it to Sentry.
4747

48-
#### Adding Additional Spans to the Transaction
48+
You can also take advantage of promises when creating spans for async operations. Keep in mind, though, that a span must finish before `transaction.finish()` is called in order to be included in the transaction.
4949

50-
The next example contains the implementation of the hypothetical `processItem` function called from the code snippet in the previous section. Our SDK can determine if there is currently an open transaction and add to it all newly created spans as child operations. Keep in mind that each individual span needs to be manually finished; otherwise, that span will not show up in the transaction.
50+
For example:
5151

5252
```javascript
5353
function processItem(item, transaction) {
5454
const span = transaction.startChild({
5555
op: "http",
56-
description: "GET /",
56+
description: `GET /items/:item-id`,
5757
});
5858

5959
return new Promise((resolve, reject) => {

src/platforms/javascript/common/performance/sampling.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ sidebar_order: 20
44
description: "Learn how to configure the volume of transactions sent to Sentry."
55
---
66

7-
There are two ways to control the volume of transactions sent to Sentry.
7+
You can control the volume of transactions sent to Sentry in two ways.
88

99
## Uniform Sample Rate
1010

1111
Setting a uniform sample rate is a good option if you want an even cross-section of transactions, no matter where in your app or under what circumstances they occur, and are happy with the default inheritance and precedence behavior described below.
1212

13-
To do this, set the `tracesSampleRate` option in your `Sentry.init()` to a number between 0 and 1, and every transaction created will have that percentage chance of being sent to Sentry. (So, for example, if you set `tracesSampleRate` to `0.2`, approximately 20% of your transactions will get recorded and sent.) That looks like this:
13+
To do this, set the `tracesSampleRate` option in your `Sentry.init()` to a number between 0 and 1. With this option set, every transaction created will have that percentage chance of being sent to Sentry. (So, for example, if you set `tracesSampleRate` to `0.2`, approximately 20% of your transactions will get recorded and sent.) That looks like this:
1414

1515
```javascript {tabTitle: ESM}
1616
// If you're using one of our integration packages, like `@sentry/react` or `@sentry/angular`,
@@ -50,13 +50,13 @@ Sentry.init({
5050

5151
## Dynamic Sampling Function
5252

53-
Providing a sampling function is a good option if you
53+
Providing a sampling function is a good option if you:
5454

5555
- want to sample different transactions at different rates
5656
- want to filer out some transactions entirely
5757
- want to modify the default precedence and inheritance behavior described below
5858

59-
To sample dynamically, set the `tracesSampler` option in your `Sentry.init()` to a function which will accept a `samplingContext` object and return a sample rate between 0 and 1. For example:
59+
To sample dynamically, set the `tracesSampler` option in your `Sentry.init()` to a function that will accept a `samplingContext` object and return a sample rate between 0 and 1. For example:
6060

6161
```javascript
6262
tracesSampler: samplingContext => {
@@ -75,7 +75,7 @@ tracesSampler: samplingContext => {
7575
};
7676
```
7777

78-
For convenience, the function can also return a boolean. Returning `true` is equivalent to returning `1`, and will guarantee the transaction will be sent to Sentry. Returning `false` is equivalent to returning `0` and will guarantee the transaction witll **not** be sent to Sentry.
78+
For convenience, the function can also return a boolean. Returning `true` is equivalent to returning `1`, and will guarantee the transaction will be sent to Sentry. Returning `false` is equivalent to returning `0` and will guarantee the transaction will **not** be sent to Sentry.
7979

8080
### Default Sampling Context Data
8181

@@ -132,9 +132,9 @@ There are multiple ways for a transaction to end up with a sampling decision.
132132
- If the transaction has a parent, inheriting its parent's sampling decision
133133
- Absolute decision passed to `startTransaction`
134134

135-
When there's the potential for more than one of these to come into play, the decision is resolved according to the following precedence rules:
135+
When there's the potential for more than one of these to come into play, the following precedence rules apply:
136136

137137
1. If a sampling decision is passed to `startTransaction` (`startTransaction({name: "my transaction", sampled: true})`), that decision will be used, regardlesss of anything else
138138
2. If `tracesSampleRate` is defined, its decision will be used. It can choose to keep or ignore any parent sampling decision, or use the sampling context data to make its own decision or choose a sample rate for the transaction.
139-
3. If `tracesSampler` is not defined, but there's a parent sampling decision, it will be used.
139+
3. If `tracesSampler` is not defined, but there's a parent sampling decision, the parent sampling decision will be used.
140140
4. If `tracesSampler` is not defined and there's no parent sampling decision, `tracesSampleRate` will be used.

src/platforms/javascript/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Sentry.init({
125125
});
126126
```
127127

128-
Performance data is transmitted using a new event type called “transactions,” which you can learn about in [Distributed Tracing](/product/performance/distributed-tracing/). To begin capturing transactions, install the tracing package and set either `tracesSampleRate` or `tracesSampler` in your [SDK configuration](/platforms/javascript/configuration/options/#common-options). These determine what percentage of potential transactions get sent to Sentry; we recommend capturing only a sample to avoid consuming your quota too quickly.
128+
Performance data is transmitted using a new event type called “transactions,” which you can learn about in [Distributed Tracing](/product/performance/distributed-tracing/). To begin capturing transactions, install the tracing package and set either `tracesSampleRate` or `tracesSampler` in your [SDK configuration](/platforms/javascript/configuration/options/#common-options). These determine what percentage of potential transactions get sent to Sentry; we recommend capturing only a sample, as one way to adjust your overall Sentry volume to meet your needs.
129129

130130
Learn more about `tracesSampleRate` and `tracesSampler` in [Sampling Transactions](/performance/sampling).
131131

0 commit comments

Comments
 (0)