Skip to content

Commit

Permalink
Some code cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Kedar Vijay Kulkarni <[email protected]>
  • Loading branch information
Kedar Vijay Kulkarni committed Nov 12, 2021
1 parent 5af281c commit 2e3274e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/analyze/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Value: %.4f %s Threshold: %.4f is %t
`, q.Query, v1, opMap[watchItems.Operator], v2, b)
if !b {
log.Printf("\n%[2]s\n Comparison of Value and Threshold is %[1]t. Notifying...\n%[2]s\n", b, strings.Repeat("~", 80))
c <- fmt.Sprintf("\nValue: %.4f %s Threshold: %.4f is %t\n", v1, opMap[watchItems.Operator], v2, b)
c <- fmt.Sprintf("\nQuery: %s\nValue: %.4f %s Threshold: %.4f is %t\n", q.Query, v1, opMap[watchItems.Operator], v2, b)
if terminateBenchmark != "" {
tb <- true // send signal to terminate benchmark channel
}
Expand Down
18 changes: 11 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"log"
"os"
"strings"
"time"

"github.com/alexflint/go-arg"
Expand Down Expand Up @@ -89,16 +90,19 @@ func main() {
// }
tb := make(chan bool)
c := make(chan string)

queryList, err := analyze.ReadPrometheusQueries(args.Queries)
if err != nil {
log.Println(err)
return
}
log.Println("Read following queries:")
for _, item := range queryList {
log.Println(item.Query)
}
thread_ts := slackConfig.SlackNotify("New benchmark started, we will monitor it for performance and notify here with the issues.", "")
go func(c chan string) {
for i := 1; ; i++ {
log.Printf("Iteration no. %d\n", i)
queryList, err := analyze.ReadPrometheusQueries(args.Queries)
if err != nil {
log.Println(err)
return
}
log.Printf("\n%[2]s\nIteration no. %[1]d\n%[2]s\n", i, strings.Repeat("~", 80))
analyze.Queries(queryList, oc, url, bearerToken, c, tb, args.TerminateBenchmark)
time.Sleep(args.QueryFrequency)
if !args.NoClrscr {
Expand Down

0 comments on commit 2e3274e

Please sign in to comment.