Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrequencyCounter ¶
type FrequencyCounter struct {
// contains filtered or unexported fields
}
FrequencyCounter keeps track of the frequency counts for the previous interval and the current interval
func NewFrequencyCounter ¶
func NewFrequencyCounter(opts Options) FrequencyCounter
NewFrequencyCounter creates a new frequency counter
func (*FrequencyCounter) Count ¶
func (c *FrequencyCounter) Count(dur time.Duration) int64
Count returns the frequency count between now - dur and now
func (*FrequencyCounter) Record ¶
func (c *FrequencyCounter) Record(n int64)
Record records a frequency value in the corresponding bucket
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options controls the parameters for frequency counters
func (Options) NumBuckets ¶
NumBuckets returns the number of buckets
func (Options) SetInterval ¶
SetInterval sets the interval
func (Options) SetNumBuckets ¶
SetNumBuckets sets the number of buckets
Click to show internal directories.
Click to hide internal directories.