@ -200,9 +200,7 @@ func (g *Gateway) FilterChunkRefs(ctx context.Context, req *logproto.FilterChunk
// Shortcut if request does not contain filters
if len ( matchers ) == 0 {
stats . Status = labelSuccess
return & logproto . FilterChunkRefResponse {
ChunkRefs : req . Refs ,
} , nil
return & logproto . FilterChunkRefResponse { ChunkRefs : req . Refs } , nil
}
blocks := make ( [ ] bloomshipper . BlockRef , 0 , len ( req . Blocks ) )
@ -218,9 +216,7 @@ func (g *Gateway) FilterChunkRefs(ctx context.Context, req *logproto.FilterChunk
// Shortcut if request does not contain blocks
if len ( blocks ) == 0 {
stats . Status = labelSuccess
return & logproto . FilterChunkRefResponse {
ChunkRefs : req . Refs ,
} , nil
return & logproto . FilterChunkRefResponse { ChunkRefs : req . Refs } , nil
}
seriesByDay := partitionRequest ( req )
@ -233,6 +229,14 @@ func (g *Gateway) FilterChunkRefs(ctx context.Context, req *logproto.FilterChunk
"series_requested" , len ( req . Refs ) ,
)
// len(seriesByDay) should never be 0
// Not sure how this can happen, but there was a bug report
// https://github.com/grafana/loki/issues/14623
if len ( seriesByDay ) == 0 {
stats . Status = labelSuccess
return & logproto . FilterChunkRefResponse { ChunkRefs : req . Refs } , nil
}
if len ( seriesByDay ) > 1 {
stats . Status = labelFailure
return nil , errors . New ( "request time range must span exactly one day" )