newProbablisticSampler creates a sampler with the given ratio between 0 and 1. For performance it only supports ratios that are perfect divisors, i.e. 1/2, 1/3, 1/4, etc.
(sample float64)
| 40 | // newProbablisticSampler creates a sampler with the given ratio between 0 and 1. |
| 41 | // For performance it only supports ratios that are perfect divisors, i.e. 1/2, 1/3, 1/4, etc. |
| 42 | func newProbablisticSampler(sample float64) *probabilisticSampler { |
| 43 | lim := int(1 / sample) |
| 44 | |
| 45 | return &probabilisticSampler{ |
| 46 | sample: sample, |
| 47 | curr: -1, // Always sample first |
| 48 | lim: lim, |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // Sample returns if the incoming data should be sampled. Call this for |
| 53 | // every possible entry. |
no outgoing calls
no test coverage detected