BurstSampler lets Burst events pass per Period then pass the decision to NextSampler. If Sampler is not set, all subsequent events are rejected.
| 60 | // BurstSampler lets Burst events pass per Period then pass the decision to |
| 61 | // NextSampler. If Sampler is not set, all subsequent events are rejected. |
| 62 | type BurstSampler struct { |
| 63 | // Burst is the maximum number of event per period allowed before calling |
| 64 | // NextSampler. |
| 65 | Burst uint32 |
| 66 | // Period defines the burst period. If 0, NextSampler is always called. |
| 67 | Period time.Duration |
| 68 | // NextSampler is the sampler used after the burst is reached. If nil, |
| 69 | // events are always rejected after the burst. |
| 70 | NextSampler Sampler |
| 71 | |
| 72 | counter uint32 |
| 73 | resetAt int64 |
| 74 | } |
| 75 | |
| 76 | // Sample implements the Sampler interface. |
| 77 | func (s *BurstSampler) Sample(lvl Level) bool { |
nothing calls this directly
no outgoing calls
no test coverage detected