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:
145145 includePaths: [/ https? :\/\/ getsentry\. com/ , / https? :\/\/ cdn\. getsentry\. com/ ]
146146 }
147147
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+
148159 .. describe :: dataCallback
149160
150161 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() {
5252 collectWindowErrors : true ,
5353 maxMessageLength : 0 ,
5454 stackTraceLimit : 50 ,
55- autoBreadcrumbs : true
55+ autoBreadcrumbs : true ,
56+ sampleRate : 1
5657 } ;
5758 this . _ignoreOnError = 0 ;
5859 this . _isRavenInstalled = false ;
@@ -1489,7 +1490,10 @@ Raven.prototype = {
14891490 return ;
14901491 }
14911492
1492- this . _sendProcessedPayload ( data ) ;
1493+ if ( Math . random ( ) < globalOptions . sampleRate ) {
1494+ this . _sendProcessedPayload ( data ) ;
1495+ }
1496+
14931497 } ,
14941498
14951499 _getUuid : function ( ) {
You can’t perform that action at this time.
0 commit comments