Package brave.sampler
Class CountingSampler
java.lang.Object
brave.sampler.Sampler
brave.sampler.CountingSampler
public final class CountingSampler extends Sampler
This sampler is appropriate for low-traffic instrumentation (ex servers that each receive <100K
requests), or those who do not provision random trace ids. It is not appropriate for collectors
as the sampling decision isn't idempotent (consistent based on trace id).
Implementation
This initializes a random bitset of size 100 (corresponding to 1% granularity). This means that it is accurate in units of 100 traces. At runtime, this loops through the bitset, returning the value according to a counter.
-
Method Details
-
create
- Parameters:
probability
- probability a request will result in a new trace. 0 means never sample, 1 means always sample. Minimum probability is 0.01, or 1% of traces
-
isSampled
public boolean isSampled(long traceIdIgnored)loops over the pre-canned decisions, resetting to zero when it gets to the end. -
toString
-