metric

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: BSD-3-Clause Imports: 9 Imported by: 15

Documentation

Index

Constants

View Source
const (
	// DefaultRecentPointThreshold is default to 1 hour
	DefaultRecentPointThreshold = 3600

	// DefaultExpirySeconds is default to 5 minutes
	DefaultExpirySeconds = 5 * 60
)

Variables

View Source
var (
	// DefaultHistogramAggregates XXX
	DefaultHistogramAggregates = []string{"max", "median", "avg", "count"}

	// DefaultHistogramPercentiles XXX
	DefaultHistogramPercentiles = []float64{0.95}
)

Functions

func UpdateMap added in v0.3.0

func UpdateMap(dst, src map[string]Field)

UpdateMap XXX

Types

type Aggregator

type Aggregator interface {
	AddMetrics(metricType string,
		prefix string,
		fields map[string]interface{},
		tags []string,
		deviceName string,
		t ...int64)

	SubmitPackets(packet string)
	Add(metricType string, m Metric)
	Flush()
}

Aggregator XXX

func NewAggregator

func NewAggregator(
	metrics chan Metric,
	interval float64,
	hostname string,
	formatter Formatter,
	histogramAggregates []string,
	histogramPercentiles []float64,
	recentPointThreshold int64,
	expiry ...int64,
) Aggregator

NewAggregator creates a new instance of aggregator.

type Context

type Context [4]string

Context XXX

type Field added in v0.3.0

type Field struct {
	Name string
	Type string
}

Field XXX

type Formatter

type Formatter func(metric Metric) interface{}

Formatter XXX

type Generator

type Generator interface {
	Sample(value float64, timestamp int64)
	Flush(timestamp int64, interval float64) []Metric
	IsExpired(timestamp, expirySeconds int64) bool
}

Generator generates metrics

func NewGenerator

func NewGenerator(metricType string, metric Metric, formatter Formatter, histogramAggregates []string, histogramPercentiles []float64) (Generator, error)

NewGenerator creates a new instance of Generator(gauge, bucketGauge, counter, rate, count, set, histogram).

type Metric

type Metric struct {
	Name           string
	Value          interface{}
	Tags           []string
	Hostname       string
	DeviceName     string
	Timestamp      int64
	LastSampleTime int64
	Type           string
	Samplerate     float64
	Formatter      Formatter
}

Metric XXX

func NewMetric

func NewMetric(name string, value interface{}, tags ...[]string) Metric

NewMetric creates a new instance of Metric.

func (Metric) Format

func (m Metric) Format() interface{}

Format XXX

func (*Metric) IsExpired

func (m *Metric) IsExpired(timestamp, expirySeconds int64) bool

IsExpired XXX

func (*Metric) String added in v0.5.0

func (m *Metric) String() string

String XXX

Jump to

Keyboard shortcuts

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