MCPcopy
hub / github.com/rs/zerolog / BurstSampler

Struct BurstSampler

sampler.go:62–74  ·  sampler.go::BurstSampler

BurstSampler lets Burst events pass per Period then pass the decision to NextSampler. If Sampler is not set, all subsequent events are rejected.

Source from the content-addressed store, hash-verified

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.
62type 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.
77func (s *BurstSampler) Sample(lvl Level) bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected