File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,17 @@ Those configuration options are documented below:
145
145
includePaths: [/ https? :\/\/ getsentry\. com/ , / https? :\/\/ cdn\. getsentry\. com/ ]
146
146
}
147
147
148
+ .. describe :: sampleRate
149
+
150
+ A sampling rate to apply to events. A value of 0.0 will send no events,
151
+ and a value of 1.0 will send all events (default).
152
+
153
+ .. code-block :: javascript
154
+
155
+ {
156
+ sampleRate: 0.5 // send 50% of events, drop the other half
157
+ }
158
+
148
159
.. describe :: dataCallback
149
160
150
161
A function that allows mutation of the data payload right before being
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ function Raven() {
52
52
collectWindowErrors : true ,
53
53
maxMessageLength : 0 ,
54
54
stackTraceLimit : 50 ,
55
- autoBreadcrumbs : true
55
+ autoBreadcrumbs : true ,
56
+ sampleRate : 1
56
57
} ;
57
58
this . _ignoreOnError = 0 ;
58
59
this . _isRavenInstalled = false ;
@@ -1489,7 +1490,10 @@ Raven.prototype = {
1489
1490
return ;
1490
1491
}
1491
1492
1492
- this . _sendProcessedPayload ( data ) ;
1493
+ if ( Math . random ( ) < globalOptions . sampleRate ) {
1494
+ this . _sendProcessedPayload ( data ) ;
1495
+ }
1496
+
1493
1497
} ,
1494
1498
1495
1499
_getUuid : function ( ) {
You can’t perform that action at this time.
0 commit comments