Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ Those configuration options are documented below:
includePaths: [/https?:\/\/getsentry\.com/, /https?:\/\/cdn\.getsentry\.com/]
}

.. describe:: sampleRate

A sampling rate to apply to events. A value of 0.0 will send no events,
and a value of 1.0 will send all events (default).

.. code-block:: javascript

{
sampleRate: 0.5 // send 50% of events, drop the other half
}

.. describe:: dataCallback

A function that allows mutation of the data payload right before being
Expand Down
8 changes: 6 additions & 2 deletions src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function Raven() {
collectWindowErrors: true,
maxMessageLength: 0,
stackTraceLimit: 50,
autoBreadcrumbs: true
autoBreadcrumbs: true,
sampleRate: 1
};
this._ignoreOnError = 0;
this._isRavenInstalled = false;
Expand Down Expand Up @@ -1489,7 +1490,10 @@ Raven.prototype = {
return;
}

this._sendProcessedPayload(data);
if (Math.random() < globalOptions.sampleRate) {
this._sendProcessedPayload(data);
}

},

_getUuid: function () {
Expand Down