@@ -104,7 +104,16 @@ func TestTSDBMetrics(t *testing.T) {
104
104
# TYPE cortex_ingester_tsdb_head_gc_duration_seconds summary
105
105
cortex_ingester_tsdb_head_gc_duration_seconds_sum 9
106
106
cortex_ingester_tsdb_head_gc_duration_seconds_count 3
107
-
107
+ # HELP cortex_ingester_tsdb_head_out_of_order_samples_appended_total Total number of appended out of order samples.
108
+ # TYPE cortex_ingester_tsdb_head_out_of_order_samples_appended_total counter
109
+ cortex_ingester_tsdb_head_out_of_order_samples_appended_total{user="user1"} 102
110
+ cortex_ingester_tsdb_head_out_of_order_samples_appended_total{user="user2"} 102
111
+ cortex_ingester_tsdb_head_out_of_order_samples_appended_total{user="user3"} 102
112
+ # HELP cortex_ingester_tsdb_head_samples_appended_total Total number of appended samples.
113
+ # TYPE cortex_ingester_tsdb_head_samples_appended_total counter
114
+ cortex_ingester_tsdb_head_samples_appended_total{type="user1",user="float"} 101
115
+ cortex_ingester_tsdb_head_samples_appended_total{type="user2",user="float"} 101
116
+ cortex_ingester_tsdb_head_samples_appended_total{type="user3",user="float"} 101
108
117
# HELP cortex_ingester_tsdb_checkpoint_deletions_failed_total Total number of TSDB checkpoint deletions that failed.
109
118
# TYPE cortex_ingester_tsdb_checkpoint_deletions_failed_total counter
110
119
cortex_ingester_tsdb_checkpoint_deletions_failed_total 1586096
@@ -167,15 +176,31 @@ func TestTSDBMetrics(t *testing.T) {
167
176
# HELP cortex_ingester_tsdb_mmap_chunk_corruptions_total Total number of memory-mapped TSDB chunk corruptions.
168
177
# TYPE cortex_ingester_tsdb_mmap_chunk_corruptions_total counter
169
178
cortex_ingester_tsdb_mmap_chunk_corruptions_total 2577406
170
-
179
+ # HELP cortex_ingester_tsdb_mmap_chunks_total Total number of chunks that were memory-mapped.
180
+ # TYPE cortex_ingester_tsdb_mmap_chunks_total gauge
181
+ cortex_ingester_tsdb_mmap_chunks_total 0
171
182
# HELP cortex_ingester_tsdb_blocks_loaded Number of currently loaded data blocks
172
183
# TYPE cortex_ingester_tsdb_blocks_loaded gauge
173
184
cortex_ingester_tsdb_blocks_loaded 15
174
185
175
186
# HELP cortex_ingester_tsdb_reloads_total Number of times the database reloaded block data from disk.
176
187
# TYPE cortex_ingester_tsdb_reloads_total counter
177
188
cortex_ingester_tsdb_reloads_total 30
178
-
189
+ # HELP cortex_ingester_tsdb_sample_ooo_delta Delta in seconds by which a sample is considered out of order (reported regardless of OOO time window and whether sample is accepted or not).
190
+ # TYPE cortex_ingester_tsdb_sample_ooo_delta histogram
191
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="600"} 0
192
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="1800"} 3
193
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="3600"} 3
194
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="7200"} 3
195
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="10800"} 3
196
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="21600"} 3
197
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="43200"} 3
198
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="+Inf"} 3
199
+ cortex_ingester_tsdb_sample_ooo_delta_sum 2700
200
+ cortex_ingester_tsdb_sample_ooo_delta_count 3
201
+ # HELP cortex_ingester_tsdb_snapshot_replay_error_total Total number snapshot replays that failed.
202
+ # TYPE cortex_ingester_tsdb_snapshot_replay_error_total counter
203
+ cortex_ingester_tsdb_snapshot_replay_error_total 309
179
204
# HELP cortex_ingester_tsdb_reloads_failures_total Number of times the database failed to reloadBlocks block data from disk.
180
205
# TYPE cortex_ingester_tsdb_reloads_failures_total counter
181
206
cortex_ingester_tsdb_reloads_failures_total 21
@@ -318,6 +343,14 @@ func TestTSDBMetricsWithRemoval(t *testing.T) {
318
343
# TYPE cortex_ingester_tsdb_head_gc_duration_seconds summary
319
344
cortex_ingester_tsdb_head_gc_duration_seconds_sum 9
320
345
cortex_ingester_tsdb_head_gc_duration_seconds_count 3
346
+ # HELP cortex_ingester_tsdb_head_out_of_order_samples_appended_total Total number of appended out of order samples.
347
+ # TYPE cortex_ingester_tsdb_head_out_of_order_samples_appended_total counter
348
+ cortex_ingester_tsdb_head_out_of_order_samples_appended_total{user="user1"} 102
349
+ cortex_ingester_tsdb_head_out_of_order_samples_appended_total{user="user2"} 102
350
+ # HELP cortex_ingester_tsdb_head_samples_appended_total Total number of appended samples.
351
+ # TYPE cortex_ingester_tsdb_head_samples_appended_total counter
352
+ cortex_ingester_tsdb_head_samples_appended_total{type="user1",user="float"} 101
353
+ cortex_ingester_tsdb_head_samples_appended_total{type="user2",user="float"} 101
321
354
322
355
# HELP cortex_ingester_tsdb_checkpoint_deletions_failed_total Total number of TSDB checkpoint deletions that failed.
323
356
# TYPE cortex_ingester_tsdb_checkpoint_deletions_failed_total counter
@@ -377,15 +410,31 @@ func TestTSDBMetricsWithRemoval(t *testing.T) {
377
410
# HELP cortex_ingester_tsdb_mmap_chunk_corruptions_total Total number of memory-mapped TSDB chunk corruptions.
378
411
# TYPE cortex_ingester_tsdb_mmap_chunk_corruptions_total counter
379
412
cortex_ingester_tsdb_mmap_chunk_corruptions_total 2577406
380
-
413
+ # HELP cortex_ingester_tsdb_mmap_chunks_total Total number of chunks that were memory-mapped.
414
+ # TYPE cortex_ingester_tsdb_mmap_chunks_total gauge
415
+ cortex_ingester_tsdb_mmap_chunks_total 0
381
416
# HELP cortex_ingester_tsdb_blocks_loaded Number of currently loaded data blocks
382
417
# TYPE cortex_ingester_tsdb_blocks_loaded gauge
383
418
cortex_ingester_tsdb_blocks_loaded 10
384
419
385
420
# HELP cortex_ingester_tsdb_reloads_total Number of times the database reloaded block data from disk.
386
421
# TYPE cortex_ingester_tsdb_reloads_total counter
387
422
cortex_ingester_tsdb_reloads_total 30
388
-
423
+ # HELP cortex_ingester_tsdb_sample_ooo_delta Delta in seconds by which a sample is considered out of order (reported regardless of OOO time window and whether sample is accepted or not).
424
+ # TYPE cortex_ingester_tsdb_sample_ooo_delta histogram
425
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="600"} 0
426
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="1800"} 3
427
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="3600"} 3
428
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="7200"} 3
429
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="10800"} 3
430
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="21600"} 3
431
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="43200"} 3
432
+ cortex_ingester_tsdb_sample_ooo_delta_bucket{le="+Inf"} 3
433
+ cortex_ingester_tsdb_sample_ooo_delta_sum 2700
434
+ cortex_ingester_tsdb_sample_ooo_delta_count 3
435
+ # HELP cortex_ingester_tsdb_snapshot_replay_error_total Total number snapshot replays that failed.
436
+ # TYPE cortex_ingester_tsdb_snapshot_replay_error_total counter
437
+ cortex_ingester_tsdb_snapshot_replay_error_total 309
389
438
# HELP cortex_ingester_tsdb_reloads_failures_total Number of times the database failed to reloadBlocks block data from disk.
390
439
# TYPE cortex_ingester_tsdb_reloads_failures_total counter
391
440
cortex_ingester_tsdb_reloads_failures_total 21
@@ -608,6 +657,45 @@ func populateTSDBMetrics(base float64) *prometheus.Registry {
608
657
})
609
658
gcDuration .Observe (3 )
610
659
660
+ samplesAppended := promauto .With (r ).NewCounterVec (prometheus.CounterOpts {
661
+ Name : "prometheus_tsdb_head_samples_appended_total" ,
662
+ Help : "Total number of appended samples." ,
663
+ }, []string {"type" })
664
+ samplesAppended .WithLabelValues ("float" ).Add (101 )
665
+
666
+ outOfOrderSamplesAppended := promauto .With (r ).NewCounter (prometheus.CounterOpts {
667
+ Name : "prometheus_tsdb_head_out_of_order_samples_appended_total" ,
668
+ Help : "Total number of appended out of order samples." ,
669
+ })
670
+ outOfOrderSamplesAppended .Add (102 )
671
+
672
+ snapshotReplayErrorTotal := promauto .With (r ).NewCounter (prometheus.CounterOpts {
673
+ Name : "prometheus_tsdb_snapshot_replay_error_total" ,
674
+ Help : "Total number snapshot replays that failed." ,
675
+ })
676
+ snapshotReplayErrorTotal .Add (103 )
677
+
678
+ oooHistogram := promauto .With (r ).NewHistogram (prometheus.HistogramOpts {
679
+ Name : "prometheus_tsdb_sample_ooo_delta" ,
680
+ Help : "Delta in seconds by which a sample is considered out of order (reported regardless of OOO time window and whether sample is accepted or not)." ,
681
+ Buckets : []float64 {
682
+ 60 * 10 , // 10 min
683
+ 60 * 30 , // 30 min
684
+ 60 * 60 , // 60 min
685
+ 60 * 60 * 2 , // 2h
686
+ 60 * 60 * 3 , // 3h
687
+ 60 * 60 * 6 , // 6h
688
+ 60 * 60 * 12 , // 12h
689
+ },
690
+ })
691
+ oooHistogram .Observe (60 * 15 )
692
+
693
+ mmapChunksTotal := promauto .With (r ).NewCounter (prometheus.CounterOpts {
694
+ Name : "prometheus_tsdb_mmap_chunks_total" ,
695
+ Help : "Total number of chunks that were memory-mapped." ,
696
+ })
697
+ mmapChunksTotal .Add (104 )
698
+
611
699
loadedBlocks := promauto .With (r ).NewGauge (prometheus.GaugeOpts {
612
700
Name : "prometheus_tsdb_blocks_loaded" ,
613
701
Help : "Number of currently loaded data blocks" ,
0 commit comments