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: docs/platforms/javascript/common/configuration/sampling.mdx
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,8 +42,8 @@ The Sentry SDKs have two configuration options to control the volume of transact
42
42
43
43
2. Sampling function (<PlatformIdentifiername="traces-sampler" />) which:
44
44
- Samples different transactions at different rates
45
-
- <PlatformLinkto="/configuration/filtering/">Filters</PlatformLink> out some
46
-
transactions entirely
45
+
- <PlatformLinkto="/configuration/filtering/">Filters</PlatformLink> out
46
+
some transactions entirely
47
47
- Modifies default [precedence](#precedence) and [inheritance](#inheritance) behavior
48
48
49
49
By default, none of these options are set, meaning no transactions will be sent to Sentry. You must set either one of the options to start sending transactions.
@@ -98,7 +98,6 @@ There are multiple ways for a transaction to end up with a sampling decision.
98
98
99
99
When there's the potential for more than one of these to come into play, the following precedence rules apply:
100
100
101
-
1. If a sampling decision is passed to <PlatformIdentifiername="start-transaction" />, that decision will be used, overriding everything else.
102
101
1. If <PlatformIdentifiername="traces-sampler" /> is defined, its decision will be used. It can choose to keep or ignore any parent sampling decision, use the sampling context data to make its own decision, or choose a sample rate for the transaction. We advise against overriding the parent sampling decision because it will break distributed traces)
103
102
1. If <PlatformIdentifiername="traces-sampler" /> is not defined, but there's a parent sampling decision, the parent sampling decision will be used.
104
103
1. If <PlatformIdentifiername="traces-sampler" /> is not defined and there's no parent sampling decision, <PlatformIdentifiername="traces-sample-rate" /> will be used.
// Inherit the samle rate of the incoming trace if there is one. Sampling is deterministic
34
-
// for one entire trace, i.e. if the parent was sampled, we will be sampled too at the same
35
-
// rate.
36
-
if (typeofparentSampleRate==="number") {
37
-
returnparentSampleRate;
38
-
}
39
-
40
-
// Else, use default sample rate
41
-
return0.5;
33
+
// Otherwise, inherit the sample sampling decision of the incoming trace, or use a fallback sampling rate.
34
+
returninheritOrSampleWith(0.5);
42
35
},
43
36
});
44
37
```
45
38
46
39
<Alerttitle="parentSampleRate">
47
40
48
-
The `parentSampleRate` sampling context was introduced in version 9 of the SDK.
49
-
To inherit sampling decisions in earlier versions of the SDK, us the `parentSampled` sampling context.
41
+
The `inheritOrSampleWith` sampling context utility was introduced in version 9 of the SDK.
42
+
To inherit sampling decisions in earlier versions of the SDK, use the `parentSampled` sampling context.
50
43
51
-
Going forward, using `parentSampleRate` is strongly encouraged over using `parentSampled`, because it allows for deterministic sampling and metric extrapolation for downstream traces.
44
+
Going forward, using `inheritOrSampleWith()` is strongly encouraged over using `parentSampled`, because it allows for deterministic sampling and metric extrapolation for downstream traces.
0 commit comments