bucket

package
v0.0.0-...-6af4885 Latest Latest
Warning

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

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

Documentation

Overview

A collection of measurements.

Index

Constants

View Source
const DefaultUnit = "u"

Variables

This section is empty.

Functions

func NewBuckets

func NewBuckets(body *bufio.Reader, opts Options) <-chan *Bucket

Types

type Bucket

type Bucket struct {
	// A bucket can be locked to ensure safe memory access.
	sync.Mutex
	// The identity of a bucket is used in registers and as keys in redis.
	Id *Id
	// A slice of all the measurements for a bucket.
	Vals []float64 `json:"vals,omitempty"`
}

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) Count

func (b *Bucket) Count() int

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) *LibratoMetric

func (*Bucket) Metrics

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

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
	User       string
	Pass       string
	Name       string
	Units      string
	Source     string
}

func DecodeId

func DecodeId(s string) (*Id, 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() string

type LibratoMetric

type LibratoMetric struct {
	Name   string        `json:"name"`
	Time   int64         `json:"measure_time"`
	Val    float64       `json:"value"`
	Source string        `json:"source,omitempty"`
	User   string        `json:"-"`
	Pass   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).

type Options

type Options map[string][]string

Jump to

Keyboard shortcuts

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