Commit 110f1576 by Mitsuhiro Tanda

parse duration

parent c6607f3f
......@@ -254,9 +254,19 @@ func parseQuery(model *simplejson.Json) (*CloudWatchQuery, error) {
p = "60"
}
}
period, err := strconv.Atoi(p)
if err != nil {
return nil, err
period := 300
if regexp.MustCompile(`^\d+$`).Match([]byte(p)) {
period, err = strconv.Atoi(p)
if err != nil {
return nil, err
}
} else {
d, err := time.ParseDuration(p)
if err != nil {
return nil, err
}
period = int(d.Seconds())
}
alias := model.Get("alias").MustString("{{metric}}_{{stat}}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment