Skip to content

Commit

Permalink
remove results, add elapsed value to influx payload
Browse files Browse the repository at this point in the history
  • Loading branch information
jhrv committed Aug 6, 2021
1 parent 49bb9f7 commit 1c1239d
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions poke.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down Expand Up @@ -69,8 +63,6 @@ func main() {
for {
timestamp := time.Now().Unix()

var results []Result

var payloadElements []string
for _, poke := range pokes {
resultCode := Error
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1c1239d

Please sign in to comment.