ProbabilitySampler
class ProbabilitySampler implements SamplerInterface
This implementation of the SamplerInterface uses a pseudo-random number generator to sample a percentage of requests.
Example:
use OpenCensus\Trace\Sampler\ProbabilitySampler;
// Create a new sampler that will return true 10% of the time
$sampler = new ProbabilitySampler(0.1);
Methods
__construct($rate)
Creates the ProbabilitySampler
bool
shouldSample()
Uses a pseudo-random number generator to decide if we should sample the request.
float
rate()
Return the percentage of requests to sample represented as a float between 0 and 1
Details
at line 44
__construct($rate)
Creates the ProbabilitySampler
at line 58
bool
shouldSample()
Uses a pseudo-random number generator to decide if we should sample the request.
at line 68
float
rate()
Return the percentage of requests to sample represented as a float between 0 and 1