bucket

package
v0.0.0-...-cfa2fc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2013 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

A collection of measurements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	sync.Mutex
	Id   *Id
	Vals []float64
}

func (*Bucket) Add

func (b *Bucket) Add(otherM *Bucket)

Adding bucket a to bucket b copies the vals of bucket b and appends them to the vals of bucket a. Nothing is done with the Ids of the buckets. You should ensure that buckets have the same Id.

func (*Bucket) ComplexMetric

func (b *Bucket) ComplexMetric() *LibratoMetric

func (*Bucket) Count

func (b *Bucket) Count() int

func (*Bucket) EmitCounters

func (b *Bucket) EmitCounters() []*LibratoMetric

func (*Bucket) EmitMeasurements

func (b *Bucket) EmitMeasurements() []*LibratoMetric

The standard emitter. All log data with `measure.foo` will be mapped to the MeasureEmitter.

func (*Bucket) EmiteSamples

func (b *Bucket) EmiteSamples() []*LibratoMetric

func (*Bucket) Last

func (b *Bucket) Last() float64

func (*Bucket) Max

func (b *Bucket) Max() float64

func (*Bucket) Mean

func (b *Bucket) Mean() float64

func (*Bucket) Median

func (b *Bucket) Median() float64

func (*Bucket) Metric

func (b *Bucket) Metric(name string, val float64) *LibratoMetric

func (*Bucket) Metrics

func (b *Bucket) Metrics() []*LibratoMetric

Relies on the Emitter to determine which type of metrics should be returned.

func (*Bucket) Min

func (b *Bucket) Min() float64

func (*Bucket) P95

func (b *Bucket) P95() float64

func (*Bucket) P99

func (b *Bucket) P99() float64

func (*Bucket) Sort

func (b *Bucket) Sort()

func (*Bucket) String

func (b *Bucket) String() string

func (*Bucket) Sum

func (b *Bucket) Sum() float64

type Id

type Id struct {
	Time       time.Time
	Resolution time.Duration
	Auth       string
	ReadyAt    time.Time
	Name       string
	Units      string
	Source     string
	Type       string
}

func (*Id) Decode

func (id *Id) Decode(b *bytes.Buffer) error

func (*Id) Delay

func (id *Id) Delay(t time.Time) int64

The number of time units returned represents the processing time accumulated within l2met. E.g. If the resolution of the bucket/id is 60s and the delay is 2, then it took 120s for l2met to process the bucket.

func (*Id) Encode

func (id *Id) Encode() ([]byte, error)

func (*Id) Partition

func (id *Id) Partition(max uint64) uint64

type LibratoMetric

type LibratoMetric struct {
	Name   string        `json:"name"`
	Time   int64         `json:"measure_time"`
	Val    *float64      `json:"value,omitempty"`
	Count  *int          `json:"count,omitempty"`
	Sum    *float64      `json:"sum,omitempty"`
	Max    *float64      `json:"max,omitempty"`
	Min    *float64      `json:"min,omitempty"`
	Source string        `json:"source,omitempty"`
	Auth   string        `json:"-"`
	Attr   *libratoAttrs `json:"attributes,omitempty"`
}

When submitting data to Librato, we need to coerce our bucket representation into something their API can handle. Because there is not a 1-1 parity with the statistical functions that a bucket offers and the types of data the Librato API accepts (e.g. Librato does- not have support for p50, p95, p99) we need to expand our bucket into a set of LibratoMetric(s).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL