Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
Aggregator will pull from the Counter on a given interval and store rates for that interval.
func NewAggregator ¶
func NewAggregator(c RateCounter, opts ...AggregatorOption) *Aggregator
NewAggregator will return an initialized Aggregator
func (*Aggregator) Rate ¶
func (a *Aggregator) Rate(timestamp int64) (Rate, error)
Rate returns the rates for a single time period.
func (*Aggregator) Rates ¶
func (a *Aggregator) Rates() Rates
Rates returns the current state of the aggregator.
func (*Aggregator) Run ¶
func (a *Aggregator) Run()
Run starts the aggregator. This method will block indefinitely.
type AggregatorOption ¶
type AggregatorOption func(a *Aggregator)
AggregatorOption are funcs that can be used to configure an Aggregator at initialization.
func WithMaxRateBuckets ¶
func WithMaxRateBuckets(n int) AggregatorOption
WithMaxRateBuckets returns an AggregatorOption to configure the max number of Rate bucketes to store.
func WithPollingInterval ¶
func WithPollingInterval(d time.Duration) AggregatorOption
WithPollingInterval returns an AggregatorOption to configure the polling interval. The polling interval determines how often the aggregator will poll data from the counter. The polling interval is also isued to determine the amount of time that is used for the rate. E.g. If the polling interval is 1 minute, then rates are calculated as number of logs per minute.
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter stores data about the number of logs emitted per application.
type RateCounter ¶
RateCounter is the interface the Aggregator will poll data from.