datapoint

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datapoint

type Datapoint struct {
	// What is being measured.  We think metric, rather than "unit" of metrics20, should be the
	// required identitiy of a datapoint and the "unit" should be a property of the Value itself
	Metric string
	// Dimensions of what is being measured.  They are intrinsic.  Contributes to the identity of
	// the metric. If this changes, we get a new metric identifier
	Dimensions map[string]string
	// Meta is information that's not paticularly important to the datapoint, but may be important
	// to the pipeline that uses the datapoint.  They are extrinsic.  It provides additional
	// information about the metric. changes in this set doesn't change the metric identity
	Meta map[interface{}]interface{}
	// Value of the datapoint
	Value Value
	// The type of the datapoint series
	MetricType MetricType
	// The unix time of the datapoint
	Timestamp time.Time
}

A Datapoint is the metric that is saved. Designe around http://metrics20.org/spec/

func New

func New(metric string, dimensions map[string]string, value Value, metricType MetricType, timestamp time.Time) *Datapoint

New creates a new datapoint with empty meta data

func NewWithMeta

func NewWithMeta(metric string, dimensions map[string]string, meta map[interface{}]interface{}, value Value, metricType MetricType, timestamp time.Time) *Datapoint

NewWithMeta creates a new datapoint with passed metadata

func (*Datapoint) String

func (dp *Datapoint) String() string

type FloatValue

type FloatValue interface {
	Value
	Float() float64
}

FloatValue are values that represent an exact floating point value.

func NewFloatValue

func NewFloatValue(val float64) FloatValue

NewFloatValue creates new datapoint value is a float

type IntValue

type IntValue interface {
	Value
	Int() int64
}

IntValue are values that represent an exact integer point value.

func NewIntValue

func NewIntValue(val int64) IntValue

NewIntValue creates new datapoint value is an integer

type MetricType

type MetricType int

MetricType define how to display the Value. It's more metadata of the series than data about the series itself. See target_type of http://metrics20.org/spec/

const (
	// Gauge is values at each point in time
	Gauge MetricType = iota
	// Count is a number per a given interval (such as a statsd flushInterval); not very useful
	Count
	// Enum is an added type: Values aren't important relative to each other but are just important as distinct
	//             items in a set.  Usually used when Value is type "string"
	Enum
	// Counter is a number that keeps increasing over time (but might wrap/reset at some points)
	// (no statsd counterpart), i.e. a gauge with the added notion of "i usually want to derive this"
	Counter
	// Rate is a number per second
	Rate
	// Timestamp value represents a unix timestamp
	Timestamp
)

type StringValue

type StringValue interface {
	Value
}

StringValue are values that represent an exact string value and don't have a numeric representation.

func NewStringValue

func NewStringValue(val string) StringValue

NewStringValue creates new datapoint value is a string

type Value

type Value interface {
	fmt.Stringer
}

A Value is the value being sent between servers. It is usually a floating point but different systems support different types of values. All values must be printable in some human readable interface

Jump to

Keyboard shortcuts

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