forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 11
/
metric.go
79 lines (63 loc) · 1.41 KB
/
metric.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package telegraf
import (
"time"
)
// 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
Summary
Histogram
)
type Tag struct {
Key string
Value string
}
type Field struct {
Key string
Value interface{}
}
type Metric interface {
// 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)
// Tag functions
GetTag(key string) (string, bool)
HasTag(key string) bool
AddTag(key, value string)
RemoveTag(key string)
// Field functions
GetField(key string) (interface{}, bool)
HasField(key string) bool
AddField(key string, value interface{})
RemoveField(key string)
SetTime(t time.Time)
// HashID returns an unique identifier for the series.
HashID() uint64
// Copy returns a deep copy of the Metric.
Copy() Metric
// Accept marks the metric as processed successfully and written to an
// output.
Accept()
// Reject marks the metric as processed unsuccessfully.
Reject()
// Drop marks the metric as processed successfully without being written
// to any output.
Drop()
// Mark Metric as an aggregate
SetAggregate(bool)
IsAggregate() bool
}