diff --git a/app/vmselect/graphite/metrics_api.go b/app/vmselect/graphite/metrics_api.go index dee82e39d..1c328be21 100644 --- a/app/vmselect/graphite/metrics_api.go +++ b/app/vmselect/graphite/metrics_api.go @@ -22,9 +22,6 @@ import ( // See https://graphite-api.readthedocs.io/en/latest/api.html#metrics-find func MetricsFindHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } format := r.FormValue("format") if format == "" { format = "treejson" @@ -119,9 +116,6 @@ func deduplicatePaths(paths []string, delimiter string) []string { // See https://graphite-api.readthedocs.io/en/latest/api.html#metrics-expand func MetricsExpandHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } queries := r.Form["query"] if len(queries) == 0 { return fmt.Errorf("missing `query` arg") @@ -202,9 +196,6 @@ func MetricsExpandHandler(startTime time.Time, w http.ResponseWriter, r *http.Re // See https://graphite-api.readthedocs.io/en/latest/api.html#metrics-index-json func MetricsIndexHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } jsonp := r.FormValue("jsonp") metricNames, err := netstorage.GetLabelValues(nil, "__name__", deadline) if err != nil { diff --git a/app/vmselect/graphite/tags_api.go b/app/vmselect/graphite/tags_api.go index 10313e018..43b3c51cd 100644 --- a/app/vmselect/graphite/tags_api.go +++ b/app/vmselect/graphite/tags_api.go @@ -24,9 +24,6 @@ import ( // See https://graphite.readthedocs.io/en/stable/tags.html#removing-series-from-the-tagdb func TagsDelSeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } paths := r.Form["path"] totalDeleted := 0 var row graphiteparser.Row @@ -163,9 +160,6 @@ var ( // See https://graphite.readthedocs.io/en/stable/tags.html#auto-complete-support func TagsAutoCompleteValuesHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } limit, err := getInt(r, "limit") if err != nil { return err @@ -252,9 +246,6 @@ var tagsAutoCompleteValuesDuration = metrics.NewSummary(`vm_request_duration_sec // See https://graphite.readthedocs.io/en/stable/tags.html#auto-complete-support func TagsAutoCompleteTagsHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } limit, err := getInt(r, "limit") if err != nil { return err @@ -334,9 +325,6 @@ var tagsAutoCompleteTagsDuration = metrics.NewSummary(`vm_request_duration_secon // See https://graphite.readthedocs.io/en/stable/tags.html#exploring-tags func TagsFindSeriesHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } limit, err := getInt(r, "limit") if err != nil { return err @@ -405,9 +393,6 @@ var tagsFindSeriesDuration = metrics.NewSummary(`vm_request_duration_seconds{pat // See https://graphite.readthedocs.io/en/stable/tags.html#exploring-tags func TagValuesHandler(startTime time.Time, tagName string, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } limit, err := getInt(r, "limit") if err != nil { return err @@ -436,9 +421,6 @@ var tagValuesDuration = metrics.NewSummary(`vm_request_duration_seconds{path="/t // See https://graphite.readthedocs.io/en/stable/tags.html#exploring-tags func TagsHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } limit, err := getInt(r, "limit") if err != nil { return err diff --git a/app/vmselect/prometheus/prometheus.go b/app/vmselect/prometheus/prometheus.go index 560599f05..911287a47 100644 --- a/app/vmselect/prometheus/prometheus.go +++ b/app/vmselect/prometheus/prometheus.go @@ -59,9 +59,7 @@ func FederateHandler(startTime time.Time, w http.ResponseWriter, r *http.Request defer federateDuration.UpdateDuration(startTime) ct := startTime.UnixNano() / 1e6 - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse request form values: %w", err) - } + deadline := searchutils.GetDeadlineForQuery(r, startTime) lookbackDelta, err := getMaxLookback(r) if err != nil { return err @@ -77,7 +75,6 @@ func FederateHandler(startTime time.Time, w http.ResponseWriter, r *http.Request if err != nil { return err } - deadline := searchutils.GetDeadlineForQuery(r, startTime) if start >= end { start = end - defaultStep } @@ -119,9 +116,6 @@ var federateDuration = metrics.NewSummary(`vm_request_duration_seconds{path="/fe func ExportCSVHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { defer exportCSVDuration.UpdateDuration(startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse request form values: %w", err) - } format := r.FormValue("format") if len(format) == 0 { return fmt.Errorf("missing `format` arg; see https://docs.victoriametrics.com/#how-to-export-csv-data") @@ -213,9 +207,6 @@ var exportCSVDuration = metrics.NewSummary(`vm_request_duration_seconds{path="/a func ExportNativeHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { defer exportNativeDuration.UpdateDuration(startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse request form values: %w", err) - } ep, err := getExportParams(r, startTime) if err != nil { return err @@ -278,9 +269,6 @@ var bbPool bytesutil.ByteBufferPool func ExportHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { defer exportDuration.UpdateDuration(startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse request form values: %w", err) - } ep, err := getExportParams(r, startTime) if err != nil { return err @@ -443,9 +431,6 @@ func DeleteHandler(startTime time.Time, r *http.Request) error { defer deleteDuration.UpdateDuration(startTime) deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse request form values: %w", err) - } if r.FormValue("start") != "" || r.FormValue("end") != "" { return fmt.Errorf("start and end aren't supported. Remove these args from the query in order to delete all the matching metrics") } @@ -474,9 +459,6 @@ func LabelValuesHandler(qt *querytracer.Tracer, startTime time.Time, labelName s defer labelValuesDuration.UpdateDuration(startTime) deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err @@ -646,9 +628,6 @@ func TSDBStatusHandler(startTime time.Time, w http.ResponseWriter, r *http.Reque defer tsdbStatusDuration.UpdateDuration(startTime) deadline := searchutils.GetDeadlineForStatusRequest(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err @@ -729,9 +708,6 @@ func LabelsHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseW defer labelsDuration.UpdateDuration(startTime) deadline := searchutils.GetDeadlineForQuery(r, startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } etfs, err := searchutils.GetExtraTagFilters(r) if err != nil { return err @@ -880,10 +856,8 @@ var seriesCountDuration = metrics.NewSummary(`vm_request_duration_seconds{path=" func SeriesHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseWriter, r *http.Request) error { defer seriesDuration.UpdateDuration(startTime) + deadline := searchutils.GetDeadlineForQuery(r, startTime) ct := startTime.UnixNano() / 1e6 - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } end, err := searchutils.GetTime(r, "end", ct) if err != nil { return err @@ -897,7 +871,6 @@ func SeriesHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseW if err != nil { return err } - deadline := searchutils.GetDeadlineForQuery(r, startTime) tagFilterss, err := getTagFilterssFromRequest(r) if err != nil { @@ -980,6 +953,7 @@ func QueryHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseWr defer queryDuration.UpdateDuration(startTime) ct := startTime.UnixNano() / 1e6 + deadline := searchutils.GetDeadlineForQuery(r, startTime) mayCache := !searchutils.GetBool(r, "nocache") query := r.FormValue("query") if len(query) == 0 { @@ -1000,7 +974,6 @@ func QueryHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseWr if step <= 0 { step = defaultStep } - deadline := searchutils.GetDeadlineForQuery(r, startTime) if len(query) > maxQueryLen.N { return fmt.Errorf("too long query; got %d bytes; mustn't exceed `-search.maxQueryLen=%d` bytes", len(query), maxQueryLen.N) @@ -1343,9 +1316,6 @@ func getLatencyOffsetMilliseconds() int64 { func QueryStatsHandler(startTime time.Time, w http.ResponseWriter, r *http.Request) error { defer queryStatsDuration.UpdateDuration(startTime) - if err := r.ParseForm(); err != nil { - return fmt.Errorf("cannot parse form values: %w", err) - } topN := 20 topNStr := r.FormValue("topN") if len(topNStr) > 0 {