From 8dfe95761e6b724bf8adbc6782c2155ff218adae Mon Sep 17 00:00:00 2001 From: ChenyuanHu Date: Thu, 29 Dec 2022 21:18:00 +0800 Subject: [PATCH] app/vmselect/prometheus: no need manually call queryDuration.UpdateDuration (#3564) There is no need to manually call `queryDuration.UpdateDuration(startTime)`, because `defer queryDuration.UpdateDuration(startTime)` is executed at the beginning of the function(L660). --- app/vmselect/prometheus/prometheus.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/vmselect/prometheus/prometheus.go b/app/vmselect/prometheus/prometheus.go index 0454499e51..321f8bad3a 100644 --- a/app/vmselect/prometheus/prometheus.go +++ b/app/vmselect/prometheus/prometheus.go @@ -811,7 +811,6 @@ func QueryHandler(qt *querytracer.Tracer, startTime time.Time, at *auth.Token, w if err := exportHandler(qt, at, w, cp, "promapi", 0, false); err != nil { return fmt.Errorf("error when exporting data for query=%q on the time range (start=%d, end=%d): %w", childQuery, start, end, err) } - queryDuration.UpdateDuration(startTime) return nil } if childQuery, windowExpr, stepExpr, offsetExpr := promql.IsRollup(query); childQuery != "" { @@ -827,7 +826,6 @@ func QueryHandler(qt *querytracer.Tracer, startTime time.Time, at *auth.Token, w if err := queryRangeHandler(qt, startTime, at, w, childQuery, start, end, step, r, ct, etfs); err != nil { return fmt.Errorf("error when executing query=%q on the time range (start=%d, end=%d, step=%d): %w", childQuery, start, end, step, err) } - queryDuration.UpdateDuration(startTime) return nil }