Skip to content

Commit

Permalink
Handle nil check for Timing
Browse files Browse the repository at this point in the history
  • Loading branch information
v9n committed Dec 11, 2019
1 parent 0f6f855 commit 9eae7a1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions extras/gaia/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,18 @@ type EventCheckTCPResult struct {
}

func (e *EventCheckTCPResult) MetricPayload() (map[string]interface{}, error) {
return map[string]interface{}{
m := map[string]interface{}{
"error": e.Result.Error,
"from_ip": e.IP,
"from_region": e.Region,
"port_open": e.Result.PortOpen,
"time_Total": e.Result.Timing.Total,
}, nil
}

if e.Result.Timing {
m["time_Total"] = e.Result.Timing.Total
}

return m, nil
}

func (e *EventCheckTCPResult) QueuePayload() ([]byte, error) {
Expand Down

0 comments on commit 9eae7a1

Please sign in to comment.