From 1c1239dba6997602c092d0b24476fe31c0b7d387 Mon Sep 17 00:00:00 2001 From: Johnny Horvi Date: Fri, 6 Aug 2021 15:54:30 +0200 Subject: [PATCH] remove results, add elapsed value to influx payload --- poke.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/poke.go b/poke.go index f2c5d96..be7def6 100644 --- a/poke.go +++ b/poke.go @@ -31,12 +31,6 @@ type Poke struct { Tags map[string]string `json:"tags"` } -type Result struct { - latency int64 - status int - poke Poke -} - func init() { flag.StringVar(&influxdbEndpoint, "influxdbEndpoint", "", "Which InfluxDB endpoint to post the results to (required)") flag.StringVar(&endpointsFile, "endpoints", "", "JSON-file containing your endpoints (required)") @@ -69,8 +63,6 @@ func main() { for { timestamp := time.Now().Unix() - var results []Result - var payloadElements []string for _, poke := range pokes { resultCode := Error @@ -98,9 +90,8 @@ func main() { } } - elem := fmt.Sprintf("%s,%s value=%d,counter=%d,err=\"%s\" %d", measurementName, tags(poke), resultCode, counter, errorMsg, timestamp) + elem := fmt.Sprintf("%s,%s elapsed=%d,value=%d,counter=%d,err=\"%s\" %d", measurementName, tags(poke), elapsed, resultCode, counter, errorMsg, timestamp) payloadElements = append(payloadElements, elem) - results = append(results, Result{elapsed, resultCode, poke}) } if err := postToInfluxDB(strings.Join(payloadElements, "\n")); err != nil {