2016-01-27 21:21:36 +00:00
|
|
|
package telegraf
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2016-11-22 12:51:57 +00:00
|
|
|
// TODO remove
|
2016-01-27 21:21:36 +00:00
|
|
|
"github.com/influxdata/influxdb/client/v2"
|
|
|
|
)
|
|
|
|
|
2016-08-30 17:09:48 +00:00
|
|
|
// ValueType is an enumeration of metric types that represent a simple value.
|
|
|
|
type ValueType int
|
|
|
|
|
|
|
|
// Possible values for the ValueType enum.
|
|
|
|
const (
|
|
|
|
_ ValueType = iota
|
|
|
|
Counter
|
|
|
|
Gauge
|
|
|
|
Untyped
|
|
|
|
)
|
|
|
|
|
2016-01-27 21:21:36 +00:00
|
|
|
type Metric interface {
|
2016-11-22 12:51:57 +00:00
|
|
|
Serialize() []byte
|
|
|
|
String() string // convenience function for string(Serialize())
|
|
|
|
Copy() Metric
|
2016-01-27 21:21:36 +00:00
|
|
|
|
2016-11-22 12:51:57 +00:00
|
|
|
// Tag functions
|
|
|
|
HasTag(key string) bool
|
|
|
|
AddTag(key, value string)
|
2016-12-01 15:18:46 +00:00
|
|
|
RemoveTag(key string)
|
2016-01-27 21:21:36 +00:00
|
|
|
|
2016-11-22 12:51:57 +00:00
|
|
|
// Field functions
|
|
|
|
HasField(key string) bool
|
|
|
|
AddField(key string, value interface{})
|
2016-12-01 15:18:46 +00:00
|
|
|
RemoveField(key string) error
|
2016-01-27 21:21:36 +00:00
|
|
|
|
2016-11-22 12:51:57 +00:00
|
|
|
// Name functions
|
|
|
|
SetName(name string)
|
|
|
|
SetPrefix(prefix string)
|
|
|
|
SetSuffix(suffix string)
|
2016-08-30 17:09:48 +00:00
|
|
|
|
2016-11-22 12:51:57 +00:00
|
|
|
// Getting data structure functions
|
|
|
|
Name() string
|
|
|
|
Tags() map[string]string
|
|
|
|
Fields() map[string]interface{}
|
|
|
|
Time() time.Time
|
2016-01-27 21:21:36 +00:00
|
|
|
UnixNano() int64
|
2016-11-22 12:51:57 +00:00
|
|
|
Type() ValueType
|
|
|
|
Len() int // returns the length of the serialized metric, including newline
|
2016-09-08 14:22:10 +00:00
|
|
|
HashID() uint64
|
|
|
|
|
2016-11-22 12:51:57 +00:00
|
|
|
// aggregator things:
|
2016-09-08 14:22:10 +00:00
|
|
|
SetAggregate(bool)
|
|
|
|
IsAggregate() bool
|
2016-11-23 12:30:31 +00:00
|
|
|
|
2016-11-22 12:51:57 +00:00
|
|
|
// Point returns a influxdb client.Point object
|
|
|
|
// TODO remove this function
|
|
|
|
Point() *client.Point
|
2016-11-23 12:30:31 +00:00
|
|
|
}
|