2016-01-27 21:21:36 +00:00
|
|
|
package telegraf
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
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
|
2017-10-24 23:28:52 +00:00
|
|
|
Summary
|
|
|
|
Histogram
|
2016-08-30 17:09:48 +00:00
|
|
|
)
|
|
|
|
|
2018-03-28 00:30:51 +00:00
|
|
|
type Tag struct {
|
|
|
|
Key string
|
|
|
|
Value string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Field struct {
|
|
|
|
Key string
|
|
|
|
Value interface{}
|
|
|
|
}
|
|
|
|
|
2016-01-27 21:21:36 +00:00
|
|
|
type Metric interface {
|
2018-03-28 00:30:51 +00:00
|
|
|
// Getting data structure functions
|
|
|
|
Name() string
|
|
|
|
Tags() map[string]string
|
|
|
|
TagList() []*Tag
|
|
|
|
Fields() map[string]interface{}
|
|
|
|
FieldList() []*Field
|
|
|
|
Time() time.Time
|
|
|
|
Type() ValueType
|
|
|
|
|
|
|
|
// Name functions
|
|
|
|
SetName(name string)
|
|
|
|
AddPrefix(prefix string)
|
|
|
|
AddSuffix(suffix string)
|
2016-01-27 21:21:36 +00:00
|
|
|
|
2016-11-22 12:51:57 +00:00
|
|
|
// Tag functions
|
2018-03-28 00:30:51 +00:00
|
|
|
GetTag(key string) (string, bool)
|
2016-11-22 12:51:57 +00:00
|
|
|
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
|
2018-03-28 00:30:51 +00:00
|
|
|
GetField(key string) (interface{}, bool)
|
2016-11-22 12:51:57 +00:00
|
|
|
HasField(key string) bool
|
|
|
|
AddField(key string, value interface{})
|
2018-03-28 00:30:51 +00:00
|
|
|
RemoveField(key string)
|
2016-08-30 17:09:48 +00:00
|
|
|
|
2018-03-28 00:30:51 +00:00
|
|
|
// HashID returns an unique identifier for the series.
|
2016-09-08 14:22:10 +00:00
|
|
|
HashID() uint64
|
|
|
|
|
2018-03-28 00:30:51 +00:00
|
|
|
// Copy returns a deep copy of the Metric.
|
|
|
|
Copy() Metric
|
|
|
|
|
|
|
|
// Mark Metric as an aggregate
|
2016-09-08 14:22:10 +00:00
|
|
|
SetAggregate(bool)
|
|
|
|
IsAggregate() bool
|
2016-11-23 12:30:31 +00:00
|
|
|
}
|