Skip to content

Commit 995dfb8

Browse files
authored
Add sample rate to SDK docs. (#104)
1 parent faed3f3 commit 995dfb8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/clientdev/overview.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Additionally, the following features are highly encouraged:
3232
* Non-blocking event submission
3333
* Basic data sanitization (e.g. filtering out values that look like passwords)
3434
* Context data helpers
35+
* Event sampling
3536

3637
Usage for End-users
3738
-------------------
@@ -132,6 +133,20 @@ The resulting POST request would then transmit to::
132133
.. note:: If any of configuration values are not present, the SDK should notify the user
133134
immediately that they've misconfigured the SDK.
134135

136+
Event Sampling
137+
--------------
138+
139+
SDKs should allow the user to configure what percentage of events are actually
140+
sent to the server (the rest should be silently ignored). For example:
141+
142+
.. sourcecode:: python
143+
144+
sample_rate = options.get('sample_rate', 1.0)
145+
146+
# assuming random() returns a value between 0.0 (inclusive) and 1.0 (exclusive)
147+
if random() < sample_rate:
148+
raven.send(data)
149+
135150
Building the JSON Packet
136151
------------------------
137152

0 commit comments

Comments
 (0)