mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
lib/httputils: handle step=undefined query arg as an empty value
This is needed for Grafana, which may send step=undefined when working with alerting rules and instant queries.
This commit is contained in:
parent
992d239745
commit
2261936e8b
1 changed files with 4 additions and 0 deletions
|
@ -14,6 +14,10 @@ func GetDuration(r *http.Request, argKey string, defaultValue int64) (int64, err
|
||||||
if len(argValue) == 0 {
|
if len(argValue) == 0 {
|
||||||
return defaultValue, nil
|
return defaultValue, nil
|
||||||
}
|
}
|
||||||
|
if argValue == "undefined" {
|
||||||
|
// This hack is needed for Grafana, which may send undefined value
|
||||||
|
return defaultValue, nil
|
||||||
|
}
|
||||||
secs, err := strconv.ParseFloat(argValue, 64)
|
secs, err := strconv.ParseFloat(argValue, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Try parsing string format
|
// Try parsing string format
|
||||||
|
|
Loading…
Reference in a new issue