@@ -45,6 +45,7 @@ func TestIngester_v2Push(t *testing.T) {
45
45
"cortex_ingester_memory_users" ,
46
46
"cortex_ingester_memory_series_created_total" ,
47
47
"cortex_ingester_memory_series_removed_total" ,
48
+ "cortex_discarded_samples_total" ,
48
49
}
49
50
userID := "test"
50
51
@@ -124,6 +125,9 @@ func TestIngester_v2Push(t *testing.T) {
124
125
# HELP cortex_ingester_memory_series_removed_total The total number of series that were removed per user.
125
126
# TYPE cortex_ingester_memory_series_removed_total counter
126
127
cortex_ingester_memory_series_removed_total{user="test"} 0
128
+ # HELP cortex_discarded_samples_total The total number of samples that were discarded.
129
+ # TYPE cortex_discarded_samples_total counter
130
+ cortex_discarded_samples_total{reason="sample-out-of-order",user="test"} 1
127
131
` ,
128
132
},
129
133
"should soft fail on sample out of bound" : {
@@ -160,6 +164,9 @@ func TestIngester_v2Push(t *testing.T) {
160
164
# HELP cortex_ingester_memory_series_removed_total The total number of series that were removed per user.
161
165
# TYPE cortex_ingester_memory_series_removed_total counter
162
166
cortex_ingester_memory_series_removed_total{user="test"} 0
167
+ # HELP cortex_discarded_samples_total The total number of samples that were discarded.
168
+ # TYPE cortex_discarded_samples_total counter
169
+ cortex_discarded_samples_total{reason="out-of-bounds",user="test"} 1
163
170
` ,
164
171
},
165
172
"should soft fail on two different sample values at the same timestamp" : {
@@ -196,6 +203,9 @@ func TestIngester_v2Push(t *testing.T) {
196
203
# HELP cortex_ingester_memory_series_removed_total The total number of series that were removed per user.
197
204
# TYPE cortex_ingester_memory_series_removed_total counter
198
205
cortex_ingester_memory_series_removed_total{user="test"} 0
206
+ # HELP cortex_discarded_samples_total The total number of samples that were discarded.
207
+ # TYPE cortex_discarded_samples_total counter
208
+ cortex_discarded_samples_total{reason="new-value-for-timestamp",user="test"} 1
199
209
` ,
200
210
},
201
211
}
@@ -204,6 +214,9 @@ func TestIngester_v2Push(t *testing.T) {
204
214
t .Run (testName , func (t * testing.T ) {
205
215
registry := prometheus .NewRegistry ()
206
216
217
+ registry .MustRegister (validation .DiscardedSamples )
218
+ validation .DiscardedSamples .Reset ()
219
+
207
220
// Create a mocked ingester
208
221
cfg := defaultIngesterTestConfig ()
209
222
cfg .LifecyclerConfig .JoinAfter = 0
0 commit comments