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
| package agent
|
| import (
| "io/ioutil"
| "runtime"
| "strconv"
| )
|
| // runtimeStats is used to return various runtime information
| func runtimeStats() map[string]string {
| return map[string]string{
| "os": runtime.GOOS,
| "arch": runtime.GOARCH,
| "version": runtime.Version(),
| "max_procs": strconv.FormatInt(int64(runtime.GOMAXPROCS(0)), 10),
| "goroutines": strconv.FormatInt(int64(runtime.NumGoroutine()), 10),
| "cpu_count": strconv.FormatInt(int64(runtime.NumCPU()), 10),
| }
| }
|
| //file to []byte
|
| func filetobytes(filepath string) ([]byte, error) {
| buf, err := ioutil.ReadFile(filepath)
| if err != nil {
| return nil, err
| }
| return buf, nil
| }
|
|