-
Notifications
You must be signed in to change notification settings - Fork 1
/
metadata.go
50 lines (43 loc) · 1022 Bytes
/
metadata.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
package outis
import (
"encoding/json"
"time"
)
// Metadata defines type of metadata used in metrics
type Metadata map[string]interface{}
// Set add data to metadata
func (md Metadata) Set(value string, args interface{}) {
md[value] = args
}
// GetBytes return the routine metadata in bytes
func (md Metadata) GetBytes() []byte {
value, _ := json.Marshal(md)
return value
}
// EventMetric defines the type of metric sent in the event
type EventMetric struct {
ID string
Latency time.Duration
StartedAt time.Time
FinishedAt time.Time
Watcher WatcherMetric
Routine RoutineMetric
Metadata Metadata
Indicators []*indicator
Histograms []*histogram
}
// RoutineMetric defines the type of metric
// of a routine sent in the event
type RoutineMetric struct {
ID string
Name string
Path string
StartedAt time.Time
}
// WatcherMetric defines the type of metric
// of a watcher sent in the event
type WatcherMetric struct {
ID string
Name string
RunAt time.Time
}