Closed matianjun1 closed 3 years ago
https://github.com/SkyAPM/go2sky/blob/520133d117488e6c3fd952f84018f4a39651d89b/sampler.go#L52-L56
rand.Intn(100) should be [0-100), so that when samplingRate is 0, IsSampled maybe true
fix like this s.threshold >= s.rand.Intn(100) + 1
s.threshold >= s.rand.Intn(100) + 1
If confused with IsSampled(), NewConstSampler always return false when input param sample is false
IsSampled()
Hi, I think use s.threshold >= s.rand.Intn(100) + 1 it's enough. Welcome to contribute.
https://github.com/SkyAPM/go2sky/blob/520133d117488e6c3fd952f84018f4a39651d89b/sampler.go#L52-L56
rand.Intn(100) should be [0-100), so that when samplingRate is 0, IsSampled maybe true
fix like this
s.threshold >= s.rand.Intn(100) + 1
If confused with
IsSampled()
, NewConstSampler always return false when input param sample is false