Skip to content

Commit

Permalink
fix: dont request query progress reporting if reporting query start f…
Browse files Browse the repository at this point in the history
…ailed (#5958)
  • Loading branch information
raj-k-singh authored Sep 17, 2024
1 parent f8e97c9 commit 83d01e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/query-service/app/http_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3656,15 +3656,18 @@ func (aH *APIHandler) queryRangeV3(ctx context.Context, queryRangeParams *v3.Que
// Hook up query progress tracking if requested
queryIdHeader := r.Header.Get("X-SIGNOZ-QUERY-ID")
if len(queryIdHeader) > 0 {
ctx = context.WithValue(ctx, "queryId", queryIdHeader)

onQueryFinished, err := aH.reader.ReportQueryStartForProgressTracking(queryIdHeader)

if err != nil {
zap.L().Error(
"couldn't report query start for progress tracking",
zap.String("queryId", queryIdHeader), zap.Error(err),
)

} else {
// Adding queryId to the context signals clickhouse queries to report progress
ctx = context.WithValue(ctx, "queryId", queryIdHeader)

defer func() {
go onQueryFinished()
}()
Expand Down

0 comments on commit 83d01e7

Please sign in to comment.