Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DurationGenerator ¶
type DurationGenerator struct {
// contains filtered or unexported fields
}
DurationGenerator generates time.Durations with variance called "jitter". Successive calls to Generate() return new randomized durations.
The zero-value returns 0 for every duration.
func NewDurationGenerator ¶
func NewDurationGenerator(base time.Duration, jitterPercent float64) DurationGenerator
NewDurationGenerator returns a new DurationGenerator with a base time duration and a percentage of jitter
func (DurationGenerator) Generate ¶
func (g DurationGenerator) Generate() time.Duration
Generate returns a new, randomized duration from the interval base±jitterPercent
func (*DurationGenerator) MarshalLogObject ¶ added in v1.6.6
func (g *DurationGenerator) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject allow zap logging
Click to show internal directories.
Click to hide internal directories.