forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.go
36 lines (33 loc) · 827 Bytes
/
data.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
package memory
import (
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/metricbeat/mb"
)
func eventsMapping(memoryDataList []MemoryData) []common.MapStr {
events := []common.MapStr{}
for _, memoryData := range memoryDataList {
events = append(events, eventMapping(&memoryData))
}
return events
}
func eventMapping(memoryData *MemoryData) common.MapStr {
event := common.MapStr{
mb.ModuleData: common.MapStr{
"container": memoryData.Container.ToMapStr(),
},
"fail": common.MapStr{
"count": memoryData.Failcnt,
},
"limit": memoryData.Limit,
"rss": common.MapStr{
"total": memoryData.TotalRss,
"pct": memoryData.TotalRssP,
},
"usage": common.MapStr{
"total": memoryData.Usage,
"pct": memoryData.UsageP,
"max": memoryData.MaxUsage,
},
}
return event
}