MCPcopy Index your code
hub / github.com/prometheus/prometheus / extractQueryOpts

Function extractQueryOpts

web/api/v1/api.go:606–618  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

604}
605
606func extractQueryOpts(r *http.Request) (promql.QueryOpts, error) {
607 var duration time.Duration
608
609 if strDuration := r.FormValue("lookback_delta"); strDuration != "" {
610 parsedDuration, err := parseDuration(strDuration)
611 if err != nil {
612 return nil, fmt.Errorf("error parsing lookback delta duration: %w", err)
613 }
614 duration = parsedDuration
615 }
616
617 return promql.NewPrometheusQueryOpts(r.FormValue("stats") == "all", duration), nil
618}
619
620func (api *API) queryRange(r *http.Request) (result apiFuncResult) {
621 limit, err := parseLimitParam(r.FormValue("limit"))

Callers 3

queryMethod · 0.85
queryRangeMethod · 0.85
TestExtractQueryOptsFunction · 0.85

Calls 2

NewPrometheusQueryOptsFunction · 0.92
parseDurationFunction · 0.70

Tested by 1

TestExtractQueryOptsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…