Skip to content

Commit a2f2a57

Browse files
authored
fix: Correct sampleRate behaviour (#1627)
1 parent ff76942 commit a2f2a57

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- [node] feat: Transactions handling for RequestHandler in Express/Hapi
1212
- [node] feat: Allow requestHandler to be configured
1313
- [node] feat: Make node transactions a pluggable integration with tests
14+
- [core] feat: getRequestheaders should handle legacy DSNs
15+
- [core] fix: correct sampleRate behaviour
1416

1517
## 4.0.6
1618

packages/core/src/baseclient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
347347

348348
const { beforeSend, sampleRate } = this.getOptions();
349349

350-
if (typeof sampleRate === 'number' && sampleRate > Math.random()) {
350+
// 1.0 === 100% events are sent
351+
// 0.0 === 0% events are sent
352+
if (typeof sampleRate === 'number' && Math.random() > sampleRate) {
351353
return {
352354
status: Status.Skipped,
353355
};

0 commit comments

Comments
 (0)