You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/product/performance/distributed-tracing.mdx
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -233,9 +233,9 @@ Individual spans aren't sent to Sentry; rather, the entire transaction is sent a
233
233
234
234
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.
235
235
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.
237
237
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.
Copy file name to clipboardExpand all lines: src/platforms/common/configuration/filtering.mdx
+13-17Lines changed: 13 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,11 @@ notSupported:
6
6
- perl
7
7
---
8
8
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.
10
10
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.
12
14
13
15
## Filtering Error Events
14
16
@@ -30,7 +32,7 @@ Typically a `hint` holds the original exception so that additional data can be e
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).
34
36
35
37
### Using Hints
36
38
@@ -89,17 +91,17 @@ To send a representative sample of your errors to Sentry, set the `sampleRate` o
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.
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:
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
-
120
116
To learn more about the `tracesSampler` option, please see [Sampling Transactions](/platforms/javascript/performance/sampling/).
121
117
122
118
</markdown></PlatformSection>
123
119
124
120
## Sampling Transaction Events
125
121
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.
127
123
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.
129
125
130
126
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.
Copy file name to clipboardExpand all lines: src/platforms/javascript/common/performance/automatic.mdx
+3-6Lines changed: 3 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -118,7 +118,7 @@ Sentry.init({
118
118
119
119
### shouldCreateSpanForRequest
120
120
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`.
122
122
123
123
```javascript
124
124
import*asSentryfrom"@sentry/browser";
@@ -128,11 +128,8 @@ Sentry.init({
128
128
integrations: [
129
129
newIntegrations.BrowserTracing({
130
130
shouldCreateSpanForRequest:url=> {
131
-
// Example of filter out spans that contain `health`
132
-
if (url.match(/health/)) {
133
-
returnfalse;
134
-
}
135
-
returntrue;
131
+
// Do not create spans for outgoing requests to a `/health/` endpoint
Copy file name to clipboardExpand all lines: src/platforms/javascript/common/performance/manual.mdx
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ span.finish(); // Remember that only finished spans will be sent with the transa
16
16
transaction.finish(); // Finishing the transaction will send it to Sentry
17
17
```
18
18
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:
20
20
21
21
```javascript
22
22
// Let's say this function is invoked when a user clicks on the checkout button of your shop
@@ -45,15 +45,15 @@ shopCheckout() {
45
45
46
46
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.
47
47
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.
49
49
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.
Copy file name to clipboardExpand all lines: src/platforms/javascript/common/performance/sampling.mdx
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ sidebar_order: 20
4
4
description: "Learn how to configure the volume of transactions sent to Sentry."
5
5
---
6
6
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.
8
8
9
9
## Uniform Sample Rate
10
10
11
11
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.
12
12
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:
14
14
15
15
```javascript {tabTitle: ESM}
16
16
// If you're using one of our integration packages, like `@sentry/react` or `@sentry/angular`,
@@ -50,13 +50,13 @@ Sentry.init({
50
50
51
51
## Dynamic Sampling Function
52
52
53
-
Providing a sampling function is a good option if you
53
+
Providing a sampling function is a good option if you:
54
54
55
55
- want to sample different transactions at different rates
56
56
- want to filer out some transactions entirely
57
57
- want to modify the default precedence and inheritance behavior described below
58
58
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:
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.
79
79
80
80
### Default Sampling Context Data
81
81
@@ -132,9 +132,9 @@ There are multiple ways for a transaction to end up with a sampling decision.
132
132
- If the transaction has a parent, inheriting its parent's sampling decision
133
133
- Absolute decision passed to `startTransaction`
134
134
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:
136
136
137
137
1. If a sampling decision is passed to `startTransaction` (`startTransaction({name: "my transaction", sampled: true})`), that decision will be used, regardlesss of anything else
138
138
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.
140
140
4. If `tracesSampler` is not defined and there's no parent sampling decision, `tracesSampleRate` will be used.
Copy file name to clipboardExpand all lines: src/platforms/javascript/index.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -125,7 +125,7 @@ Sentry.init({
125
125
});
126
126
```
127
127
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.
129
129
130
130
Learn more about `tracesSampleRate` and `tracesSampler` in [Sampling Transactions](/performance/sampling).
0 commit comments