mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
web/api/v1: fix optional skip_head for snapshot (#4674)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
7225919760
commit
3c00eeaf16
|
@ -892,10 +892,16 @@ func (api *API) snapshot(r *http.Request) (interface{}, *apiError, func()) {
|
||||||
if !api.enableAdmin {
|
if !api.enableAdmin {
|
||||||
return nil, &apiError{errorUnavailable, errors.New("Admin APIs disabled")}, nil
|
return nil, &apiError{errorUnavailable, errors.New("Admin APIs disabled")}, nil
|
||||||
}
|
}
|
||||||
skipHead, err := strconv.ParseBool(r.FormValue("skip_head"))
|
var (
|
||||||
|
skipHead bool
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if r.FormValue("skip_head") != "" {
|
||||||
|
skipHead, err = strconv.ParseBool(r.FormValue("skip_head"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, &apiError{errorUnavailable, fmt.Errorf("unable to parse boolean 'skip_head' argument: %v", err)}, nil
|
return nil, &apiError{errorUnavailable, fmt.Errorf("unable to parse boolean 'skip_head' argument: %v", err)}, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
db := api.db()
|
db := api.db()
|
||||||
if db == nil {
|
if db == nil {
|
||||||
|
|
Loading…
Reference in a new issue