@@ -226,6 +226,7 @@ type (
226226
227227 queryTopDuration struct {
228228 queryArgs
229+ query string
229230 duration time.Duration
230231 protocol int
231232 user string
@@ -2945,7 +2946,7 @@ func loadPoints(ctx context.Context, h *requestHandler, pq *queryBuilder, lod da
29452946 return nil
29462947 }})
29472948 duration := time .Since (start )
2948- h .reportQueryDuration (duration )
2949+ h .reportQueryDuration (query . body , duration )
29492950 if err != nil {
29502951 return 0 , err
29512952 }
@@ -3288,7 +3289,7 @@ func (h *requestHandler) reportQueryMemUsage(rowCount, colCount int) {
32883289 }
32893290}
32903291
3291- func (h * requestHandler ) reportQueryDuration (d time.Duration ) {
3292+ func (h * requestHandler ) reportQueryDuration (q string , d time.Duration ) {
32923293 if d <= 0 {
32933294 return
32943295 }
@@ -3305,24 +3306,24 @@ func (h *requestHandler) reportQueryDuration(d time.Duration) {
33053306 case 0 :
33063307 if len (s ) == 0 {
33073308 s = make ([]queryTopDuration , 0 , maxLen + 1 )
3308- s = append (s , h .queryDuration (d ))
3309+ s = append (s , h .queryDuration (q , d ))
33093310 } else {
33103311 s = append (s [:1 ], s ... )
33113312 if len (s ) > maxLen {
33123313 s = s [:maxLen ]
33133314 }
3314- s [0 ] = h .queryDuration (d )
3315+ s [0 ] = h .queryDuration (q , d )
33153316 }
33163317 top = true
33173318 case len (s ):
33183319 if len (s ) < maxLen && s [len (s )- 1 ].expr != h .query .Expr {
3319- s = append (s , h .queryDuration (d ))
3320+ s = append (s , h .queryDuration (q , d ))
33203321 top = true
33213322 }
33223323 default :
33233324 if s [i - 1 ].expr != h .query .Expr {
33243325 s = append (s [:i + 1 ], s [i + 1 :]... )
3325- s [i ] = h .queryDuration (d )
3326+ s [i ] = h .queryDuration (q , d )
33263327 top = true
33273328 }
33283329 }
@@ -3348,13 +3349,14 @@ func (h *requestHandler) queryMemUsage(rowCount, colCount, memUsage int) queryTo
33483349 }
33493350}
33503351
3351- func (h * requestHandler ) queryDuration (d time.Duration ) queryTopDuration {
3352+ func (h * requestHandler ) queryDuration (q string , d time.Duration ) queryTopDuration {
33523353 return queryTopDuration {
33533354 queryArgs : queryArgs {
33543355 expr : h .query .Expr ,
33553356 start : h .query .Start ,
33563357 end : h .query .End ,
33573358 },
3359+ query : q ,
33583360 duration : d ,
33593361 protocol : h .endpointStat .protocol ,
33603362 user : h .endpointStat .user ,
0 commit comments