MCPcopy
hub / github.com/grafana/tempo / newProbablisticSampler

Function newProbablisticSampler

pkg/traceql/sampler.go:42–50  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
42func 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.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected