Documentation ¶
Index ¶
- func AddMaps(a, b map[string]string) map[string]string
- type Datapoint
- type FloatValue
- type IntValue
- type MetricType
- type StringValue
- type Value
- func CastFloatValue(value interface{}) (metricValue Value, err error)
- func CastIntegerValue(value interface{}) (metricValue Value, err error)
- func CastMetricValue(value interface{}) (metricValue Value, err error)
- func CastMetricValueWithBool(value interface{}) (metricValue Value, err error)
- func CastUIntegerValue(value interface{}) (metricValue Value, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Datapoint ¶
type Datapoint struct { // What is being measured. We think metric, rather than "unit" of metrics20, should be the // required identity of a datapoint and the "unit" should be a property of the Value itself Metric string `json:"metric"` // 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 `json:"dimensions"` // Meta is information that's not particularly 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{} `json:"-"` // Value of the datapoint Value Value `json:"value"` // The type of the datapoint series MetricType MetricType `json:"metric_type"` // The unix time of the datapoint Timestamp time.Time `json:"timestamp"` }
A Datapoint is the metric that is saved. Designed 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) GetProperties ¶
GetProperties gets the map of properties to set when creating the time series associated with the datapoint. nil if no properties are set.
func (*Datapoint) RemoveProperty ¶
RemoveProperty removes a property from the map of properties to be used when the time series associated with the datapoint is created
func (*Datapoint) SetProperty ¶
SetProperty sets a property to be used when the time series associated with the datapoint is created
func (*Datapoint) UnmarshalJSON ¶
UnmarshalJSON decodes JSON into a datapoint, creating the correct Value interface types for the type of JSON value that was encoded
type FloatValue ¶
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 ¶
IntValue are values that represent an exact integer point value.
func NewIntValue ¶
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 )
func (MetricType) String ¶
func (mt MetricType) String() string
func (*MetricType) UnmarshalJSON ¶
func (mt *MetricType) UnmarshalJSON(b []byte) error
UnmarshalJSON decodes JSON number as a MetricType
func (*MetricType) UnmarshalText ¶
func (mt *MetricType) UnmarshalText(text []byte) error
UnmarshalText decodes text as a MetricType in a case-insensitive way
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 ¶
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
func CastFloatValue ¶
CastFloatValue casts a float to datapoint Value
func CastIntegerValue ¶
CastIntegerValue casts a signed integer to a datapoint Value
func CastMetricValue ¶
CastMetricValue casts an interface to datapoint Value
func CastMetricValueWithBool ¶
CastMetricValueWithBool casts an interface to datapoint Value and handles bool
func CastUIntegerValue ¶
CastUIntegerValue casts an unsigned integer to a datapoint Value