api prometheus/api/v1/label/../values time not specified, (#3052)

modify default start values
This commit is contained in:
匠心零度 2022-09-05 16:51:32 +08:00 committed by Aliaksandr Valialkin
parent 7dc632719d
commit 50e2524bc2
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -1072,12 +1072,13 @@ func getExportParams(r *http.Request, startTime time.Time) (*commonParams, error
// - extra_filters[] // - extra_filters[]
func getCommonParams(r *http.Request, startTime time.Time, requireNonEmptyMatch bool) (*commonParams, error) { func getCommonParams(r *http.Request, startTime time.Time, requireNonEmptyMatch bool) (*commonParams, error) {
deadline := searchutils.GetDeadlineForQuery(r, startTime) deadline := searchutils.GetDeadlineForQuery(r, startTime)
start, err := searchutils.GetTime(r, "start", 0) ct := startTime.UnixNano() / 1e6
start, err := searchutils.GetTime(r, "start", ct-3*defaultStep)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ct := startTime.UnixNano() / 1e6
end, err := searchutils.GetTime(r, "end", ct) end, err := searchutils.GetTime(r, "end", ct)
if err != nil { if err != nil {
return nil, err return nil, err
} }