forked from whalesburg/go-influx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetrics.go
41 lines (34 loc) · 824 Bytes
/
metrics.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
package influx
import (
"time"
)
//Metric interface
type Metric interface {
Measurement() string
Tags() map[string]string
Values() map[string]interface{}
Time() time.Time
}
// SimpleMetric is a simple struct that doesn't produce any calculatons just return it as-is
type SimpleMetric struct {
Name string
TagsMap map[string]string
ValuesMap map[string]interface{}
CreateTime time.Time
}
// Measurement returns Measurement name
func (r SimpleMetric) Measurement() string {
return r.Name
}
// Tags returns prepared tags
func (r SimpleMetric) Tags() map[string]string {
return r.TagsMap
}
// Values returns prepared values
func (r SimpleMetric) Values() map[string]interface{} {
return r.ValuesMap
}
//Time return time for the value
func (r SimpleMetric) Time() time.Time {
return r.CreateTime
}