Skip to content

Commit 740ad42

Browse files
committed
check series count before truncating
1 parent c890fc8 commit 740ad42

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/frontend/combiner/metrics_query_range.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ func NewQueryRange(req *tempopb.QueryRangeRequest, maxSeriesLimit int) (Combiner
5858
if combiner.MaxSeriesReached() {
5959
// Truncating the final response because even if we bail as soon as len(resp.Series) >= maxSeries
6060
// it's possible that the last response pushed us over the max series limit.
61-
resp.Series = resp.Series[:maxSeries]
61+
if len(resp.Series) > maxSeries {
62+
resp.Series = resp.Series[:maxSeries]
63+
}
6264
resp.Status = tempopb.PartialStatus_PARTIAL
6365
resp.Message = maxSeriesReachedErrorMsg
6466
}
@@ -73,7 +75,7 @@ func NewQueryRange(req *tempopb.QueryRangeRequest, maxSeriesLimit int) (Combiner
7375
}
7476

7577
sortResponse(resp)
76-
if combiner.MaxSeriesReached() {
78+
if len(resp.Series) > maxSeries {
7779
// Truncating the final response because even if we bail as soon as len(resp.Series) >= maxSeries
7880
// it's possible that the last response pushed us over the max series limit.
7981
resp.Series = resp.Series[:maxSeries]

0 commit comments

Comments
 (0)