|
@@ -5,6 +5,7 @@ import (
|
|
|
"fmt"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
const version = "0.0.1"
|
|
@@ -29,7 +30,9 @@ type GuptaReport struct {
|
|
|
// usually you'd want a g GuptaReport reciever here ...
|
|
|
// but than you could now check for the object properties ...
|
|
|
func (g *GuptaReport) MarshalJSON() ([]byte, error) {
|
|
|
- report := []byte("{\"timestamp\": \"now\", \"metrics\": [")
|
|
|
+ t := time.Now()
|
|
|
+ report := []byte(fmt.Sprintf("{\"timestamp\": \"%d\", \"metrics\": [",
|
|
|
+ t.Unix()))
|
|
|
if g.CPUUsage != nil {
|
|
|
usage, _ := json.Marshal(g.CPUUsage)
|
|
|
report = append(report, usage...)
|