public class RandomEventSampler extends Object implements EventSampler
Event
s should be sent to the server by applying a
sample rate to random bits from the Event's ID.Constructor and Description |
---|
RandomEventSampler(double sampleRate)
Construct a RandomEventSampler with the given sampleRate (from 0.0 to 1.0).
|
RandomEventSampler(double sampleRate,
Random random)
Construct a RandomEventSampler with the given sampleRate (from 0.0 to 1.0)
and Random instance.
|
public RandomEventSampler(double sampleRate)
sampleRate
- ratio of events to allow through to the server (from 0.0 to 1.0).public RandomEventSampler(double sampleRate, Random random)
RandomEventSampler(double)
.sampleRate
- ratio of events to allow through to the server (from 0.0 to 1.0).random
- Random instance to use for sampling, useful for testing.public boolean shouldSendEvent(Event event)
shouldSendEvent
in interface EventSampler
event
- Event to be checked against the sampling logic.Copyright © 2012–2017. All rights reserved.