Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidAgg ¶
IsValidAgg returns true if desc is a valid descriptor for an aggregator type.
Types ¶
type Aggregator ¶
type Aggregator interface { // Add records a single data point. Add(n int64) // Result returns the final output of aggregation. Result() int64 // Reset returns the aggregator to its initial state. Reset() }
Aggregator summarizes a set of integer data points to a single number.
func NewFromDescriptor ¶
func NewFromDescriptor(desc string) (Aggregator, error)
NewFromDescriptor returns an aggregator that implements desc. Returns BadDescriptorError if desc cannot be parsed.
type AggregatorFactory ¶
type AggregatorFactory func() Aggregator
AggregatorFactory creates a new Aggregator initialized to zero.
func NewFactoryFromDescriptor ¶
func NewFactoryFromDescriptor(desc string) (AggregatorFactory, error)
NewFactoryFromDescriptor returns an AggregatorFactory that will create Aggregators based on desc. Returns BadDescriptorError if desc is not a valid descriptor.
type BadDescriptorError ¶
type BadDescriptorError string
BadDescriptorError is returned when an aggregator descriptor is malformed
func (BadDescriptorError) Error ¶
func (b BadDescriptorError) Error() string
type KeyAggregator ¶
type KeyAggregator struct { // Key is the list of key fields over which we are aggregating. Key []string // contains filtered or unexported fields }
KeyAggregator tracks data across all requested event fields for a single key.
func (KeyAggregator) Add ¶
func (ka KeyAggregator) Add(e model.Event)
Add updates all aggregators tracked for this key according to the provided event.
func (*KeyAggregator) Reset ¶
func (ka *KeyAggregator) Reset()
Reset clears all aggregators to their initial state.
func (KeyAggregator) Result ¶
func (ka KeyAggregator) Result() []int64
Result returns the aggregation results for this key, in order of their appearance in the descriptor used to create the KeyAggregatorFactory.
type KeyAggregatorFactory ¶
type KeyAggregatorFactory struct { // keyFields is the names of the fields to use as keys: ["key", "size"] KeyFields []string // AggFields is the names of the fields to aggregate over, in order of display. AggFields []string // contains filtered or unexported fields }
KeyAggregatorFactory creates KeyAggregators that all share the same method of aggregation across event fields.
func NewKeyAggregatorFactory ¶
func NewKeyAggregatorFactory(desc string) (KeyAggregatorFactory, error)
NewKeyAggregatorFactory creates a KeyAggregatorFactory. The descriptor should be a comma-separated list of field names (key, size, etc.) and aggregate descriptions (sum(size), p99(latency), etc.).
func (KeyAggregatorFactory) FlatKey ¶
func (f KeyAggregatorFactory) FlatKey(e model.Event) string
FlatKey returns a string key based on the flattened key fields of an event, suitable for use in a map.
func (KeyAggregatorFactory) Key ¶
func (f KeyAggregatorFactory) Key(e model.Event) []string
Key returns a list of strings used together as the composite key for an event.
func (KeyAggregatorFactory) New ¶
func (f KeyAggregatorFactory) New() (ka KeyAggregator)
New creates a new KeyAggregator configured to perform aggregation based on the descriptor used to create this KeyAggregatorFactory.
type Max ¶
type Max struct {
// contains filtered or unexported fields
}
Max retains the maximum value in the aggregated data.
type Mean ¶
type Mean struct {
// contains filtered or unexported fields
}
Mean returns the arithmetic mean of the aggregated data.
type Min ¶
type Min struct {
// contains filtered or unexported fields
}
Min retains the minimum value in the aggregated data.
type Percentile ¶
type Percentile struct {
// contains filtered or unexported fields
}
Percentile returns the nth percentile sample from the aggregated data.
func NewPercentile ¶
func NewPercentile(quantile float64, maxValue int64) *Percentile
func (*Percentile) Add ¶
func (p *Percentile) Add(n int64)
func (*Percentile) Reset ¶
func (p *Percentile) Reset()
func (*Percentile) Result ¶
func (p *Percentile) Result() int64