promtool range query should exit when fail to parse time (#7505)

Signed-off-by: yeya24 <yb532204897@gmail.com>
This commit is contained in:
Ben Ye 2020-07-16 22:53:04 +00:00 committed by GitHub
parent b489f78f68
commit e6ea798c32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -455,11 +455,13 @@ func QueryRange(url string, headers map[string]string, query, start, end string,
stime, err = parseTime(start)
if err != nil {
fmt.Fprintln(os.Stderr, "error parsing start time:", err)
return 1
}
}
if !stime.Before(etime) {
fmt.Fprintln(os.Stderr, "start time is not before end time")
return 1
}
if step == 0 {