@@ -32,6 +32,8 @@ func NewBloomRecorder(ctx context.Context, id string) *BloomRecorder {
32
32
chunksSkipped : atomic .NewInt64 (0 ),
33
33
seriesMissed : atomic .NewInt64 (0 ),
34
34
chunksMissed : atomic .NewInt64 (0 ),
35
+ seriesEmpty : atomic .NewInt64 (0 ),
36
+ chunksEmpty : atomic .NewInt64 (0 ),
35
37
chunksFiltered : atomic .NewInt64 (0 ),
36
38
}
37
39
}
@@ -45,6 +47,8 @@ type BloomRecorder struct {
45
47
seriesSkipped , chunksSkipped * atomic.Int64
46
48
// not found in bloom
47
49
seriesMissed , chunksMissed * atomic.Int64
50
+ // exists in block index but empty offsets
51
+ seriesEmpty , chunksEmpty * atomic.Int64
48
52
// filtered out
49
53
chunksFiltered * atomic.Int64
50
54
}
@@ -56,6 +60,8 @@ func (r *BloomRecorder) Merge(other *BloomRecorder) {
56
60
r .chunksSkipped .Add (other .chunksSkipped .Load ())
57
61
r .seriesMissed .Add (other .seriesMissed .Load ())
58
62
r .chunksMissed .Add (other .chunksMissed .Load ())
63
+ r .seriesEmpty .Add (other .seriesEmpty .Load ())
64
+ r .chunksEmpty .Add (other .chunksEmpty .Load ())
59
65
r .chunksFiltered .Add (other .chunksFiltered .Load ())
60
66
}
61
67
@@ -66,13 +72,15 @@ func (r *BloomRecorder) Report(logger log.Logger, metrics *Metrics) {
66
72
seriesFound = r .seriesFound .Load ()
67
73
seriesSkipped = r .seriesSkipped .Load ()
68
74
seriesMissed = r .seriesMissed .Load ()
69
- seriesRequested = seriesFound + seriesSkipped + seriesMissed
75
+ seriesEmpty = r .seriesEmpty .Load ()
76
+ seriesRequested = seriesFound + seriesSkipped + seriesMissed + seriesEmpty
70
77
71
78
chunksFound = r .chunksFound .Load ()
72
79
chunksSkipped = r .chunksSkipped .Load ()
73
80
chunksMissed = r .chunksMissed .Load ()
74
81
chunksFiltered = r .chunksFiltered .Load ()
75
- chunksRequested = chunksFound + chunksSkipped + chunksMissed
82
+ chunksEmpty = r .chunksEmpty .Load ()
83
+ chunksRequested = chunksFound + chunksSkipped + chunksMissed + chunksEmpty
76
84
)
77
85
level .Debug (logger ).Log (
78
86
"recorder_msg" , "bloom search results" ,
@@ -82,37 +90,41 @@ func (r *BloomRecorder) Report(logger log.Logger, metrics *Metrics) {
82
90
"recorder_series_found" , seriesFound ,
83
91
"recorder_series_skipped" , seriesSkipped ,
84
92
"recorder_series_missed" , seriesMissed ,
93
+ "recorder_series_empty" , seriesEmpty ,
85
94
86
95
"recorder_chunks_requested" , chunksRequested ,
87
96
"recorder_chunks_found" , chunksFound ,
88
97
"recorder_chunks_skipped" , chunksSkipped ,
89
98
"recorder_chunks_missed" , chunksMissed ,
99
+ "recorder_chunks_empty" , chunksEmpty ,
90
100
"recorder_chunks_filtered" , chunksFiltered ,
91
101
)
92
102
93
103
if metrics != nil {
94
104
metrics .recorderSeries .WithLabelValues (recorderRequested ).Add (float64 (seriesRequested ))
95
105
metrics .recorderSeries .WithLabelValues (recorderFound ).Add (float64 (seriesFound ))
96
106
metrics .recorderSeries .WithLabelValues (recorderSkipped ).Add (float64 (seriesSkipped ))
107
+ metrics .recorderSeries .WithLabelValues (recorderEmpty ).Add (float64 (seriesEmpty ))
97
108
metrics .recorderSeries .WithLabelValues (recorderMissed ).Add (float64 (seriesMissed ))
98
109
99
110
metrics .recorderChunks .WithLabelValues (recorderRequested ).Add (float64 (chunksRequested ))
100
111
metrics .recorderChunks .WithLabelValues (recorderFound ).Add (float64 (chunksFound ))
101
112
metrics .recorderChunks .WithLabelValues (recorderSkipped ).Add (float64 (chunksSkipped ))
102
113
metrics .recorderChunks .WithLabelValues (recorderMissed ).Add (float64 (chunksMissed ))
114
+ metrics .recorderChunks .WithLabelValues (recorderEmpty ).Add (float64 (chunksEmpty ))
103
115
metrics .recorderChunks .WithLabelValues (recorderFiltered ).Add (float64 (chunksFiltered ))
104
116
}
105
117
}
106
118
107
- func (r * BloomRecorder ) record (
108
- seriesFound , chunksFound , seriesSkipped , chunksSkipped , seriesMissed , chunksMissed , chunksFiltered int ,
109
- ) {
119
+ func (r * BloomRecorder ) record (seriesFound , chunksFound , seriesSkipped , chunksSkipped , seriesMissed , chunksMissed , seriesEmpty , chunksEmpty , chunksFiltered int ) {
110
120
r .seriesFound .Add (int64 (seriesFound ))
111
121
r .chunksFound .Add (int64 (chunksFound ))
112
122
r .seriesSkipped .Add (int64 (seriesSkipped ))
113
123
r .chunksSkipped .Add (int64 (chunksSkipped ))
114
124
r .seriesMissed .Add (int64 (seriesMissed ))
115
125
r .chunksMissed .Add (int64 (chunksMissed ))
126
+ r .seriesEmpty .Add (int64 (seriesEmpty ))
127
+ r .chunksEmpty .Add (int64 (chunksEmpty ))
116
128
r .chunksFiltered .Add (int64 (chunksFiltered ))
117
129
}
118
130
@@ -170,6 +182,7 @@ func (fq *FusedQuerier) recordMissingFp(
170
182
0 , 0 , // found
171
183
0 , 0 , // skipped
172
184
1 , len (input .Chks ), // missed
185
+ 0 , 0 , // empty
173
186
0 , // chunks filtered
174
187
)
175
188
})
@@ -184,6 +197,22 @@ func (fq *FusedQuerier) recordSkippedFp(
184
197
0 , 0 , // found
185
198
1 , len (input .Chks ), // skipped
186
199
0 , 0 , // missed
200
+ 0 , 0 , // empty
201
+ 0 , // chunks filtered
202
+ )
203
+ })
204
+ }
205
+
206
+ func (fq * FusedQuerier ) recordEmptyFp (
207
+ batch []Request ,
208
+ fp model.Fingerprint ,
209
+ ) {
210
+ fq .noRemovals (batch , fp , func (input Request ) {
211
+ input .Recorder .record (
212
+ 0 , 0 , // found
213
+ 0 , 0 , // skipped
214
+ 0 , 0 , // missed
215
+ 1 , len (input .Chks ), // empty
187
216
0 , // chunks filtered
188
217
)
189
218
})
@@ -280,6 +309,19 @@ func (fq *FusedQuerier) runSeries(_ Schema, series *SeriesWithMeta, reqs []Reque
280
309
})
281
310
}
282
311
312
+ if len (series .Offsets ) == 0 {
313
+ // We end up here for series with no structured metadata fields.
314
+ // While building blooms, these series would yield empty blooms.
315
+ // We add these series to the index of the block so we don't report them as missing,
316
+ // but we don't filter any chunks for them.
317
+ level .Debug (fq .logger ).Log (
318
+ "msg" , "series with empty offsets" ,
319
+ "fp" , series .Fingerprint ,
320
+ )
321
+ fq .recordEmptyFp (reqs , series .Fingerprint )
322
+ return
323
+ }
324
+
283
325
for i , offset := range series .Offsets {
284
326
skip := fq .bq .blooms .LoadOffset (offset )
285
327
if skip {
@@ -361,6 +403,7 @@ func (fq *FusedQuerier) runSeries(_ Schema, series *SeriesWithMeta, reqs []Reque
361
403
1 , len (inputs [i ].InBlooms ), // found
362
404
0 , 0 , // skipped
363
405
0 , len (inputs [i ].Missing ), // missed
406
+ 0 , 0 , // empty
364
407
len (removals ), // filtered
365
408
)
366
409
req .Response <- Output {
0 commit comments