File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,9 @@ type BasicSampler struct {
47
47
// Sample implements the Sampler interface.
48
48
func (s * BasicSampler ) Sample (lvl Level ) bool {
49
49
n := s .N
50
+ if n == 0 {
51
+ return false
52
+ }
50
53
if n == 1 {
51
54
return true
52
55
}
Original file line number Diff line number Diff line change @@ -28,20 +28,41 @@ var samplers = []struct {
28
28
},
29
29
100 , 20 , 20 ,
30
30
},
31
+ {
32
+ "BasicSampler_0" ,
33
+ func () Sampler {
34
+ return & BasicSampler {N : 0 }
35
+ },
36
+ 100 , 0 , 0 ,
37
+ },
31
38
{
32
39
"RandomSampler" ,
33
40
func () Sampler {
34
41
return RandomSampler (5 )
35
42
},
36
43
100 , 10 , 30 ,
37
44
},
45
+ {
46
+ "RandomSampler_0" ,
47
+ func () Sampler {
48
+ return RandomSampler (0 )
49
+ },
50
+ 100 , 0 , 0 ,
51
+ },
38
52
{
39
53
"BurstSampler" ,
40
54
func () Sampler {
41
55
return & BurstSampler {Burst : 20 , Period : time .Second }
42
56
},
43
57
100 , 20 , 20 ,
44
58
},
59
+ {
60
+ "BurstSampler_0" ,
61
+ func () Sampler {
62
+ return & BurstSampler {Burst : 0 , Period : time .Second }
63
+ },
64
+ 100 , 0 , 0 ,
65
+ },
45
66
{
46
67
"BurstSamplerNext" ,
47
68
func () Sampler {
You can’t perform that action at this time.
0 commit comments