@@ -79,13 +79,6 @@ func (c *seriesStore) Get(ctx context.Context, from, through model.Time, allMatc
79
79
}
80
80
level .Debug (log ).Log ("Chunk IDs" , len (chunkIDs ))
81
81
82
- // Protect ourselves against OOMing.
83
- if len (chunkIDs ) > c .cfg .QueryChunkLimit {
84
- err := fmt .Errorf ("Query %v fetched too many chunks (%d > %d)" , allMatchers , len (chunkIDs ), c .cfg .QueryChunkLimit )
85
- level .Error (log ).Log ("err" , err )
86
- return nil , err
87
- }
88
-
89
82
// Filter out chunks that are not in the selected time range.
90
83
chunks , err := c .convertChunkIDsToChunks (ctx , chunkIDs )
91
84
if err != nil {
@@ -94,6 +87,13 @@ func (c *seriesStore) Get(ctx context.Context, from, through model.Time, allMatc
94
87
filtered , keys := filterChunksByTime (from , through , chunks )
95
88
level .Debug (log ).Log ("Chunks post filtering" , len (chunks ))
96
89
90
+ // Protect ourselves against OOMing.
91
+ if len (chunkIDs ) > c .cfg .QueryChunkLimit {
92
+ err := fmt .Errorf ("Query %v fetched too many chunks (%d > %d)" , allMatchers , len (chunkIDs ), c .cfg .QueryChunkLimit )
93
+ level .Error (log ).Log ("err" , err )
94
+ return nil , err
95
+ }
96
+
97
97
// Now fetch the actual chunk data from Memcache / S3
98
98
allChunks , err := c .fetchChunks (ctx , filtered , keys )
99
99
if err != nil {
0 commit comments