(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestCompactorMetrics(t *testing.T) { |
| 13 | reg := prometheus.NewPedanticRegistry() |
| 14 | cm := newCompactorMetricsWithLabels(reg, commonLabels, commonLabels) |
| 15 | |
| 16 | generateTestData(cm, 1234) |
| 17 | generateTestData(cm, 7654) |
| 18 | generateTestData(cm, 2222) |
| 19 | |
| 20 | err := testutil.GatherAndCompare(reg, bytes.NewBufferString(` |
| 21 | # HELP cortex_compactor_meta_base_syncs_total Total blocks metadata synchronization attempts by base Fetcher. |
| 22 | # TYPE cortex_compactor_meta_base_syncs_total counter |
| 23 | cortex_compactor_meta_base_syncs_total 11110 |
| 24 | # HELP cortex_compactor_meta_modified Number of blocks whose metadata changed |
| 25 | # TYPE cortex_compactor_meta_modified gauge |
| 26 | cortex_compactor_meta_modified{modified="replica-label-removed"} 0 |
| 27 | # HELP cortex_compactor_meta_sync_duration_seconds Duration of the blocks metadata synchronization in seconds. |
| 28 | # TYPE cortex_compactor_meta_sync_duration_seconds histogram |
| 29 | cortex_compactor_meta_sync_duration_seconds_bucket{le="0.01"} 0 |
| 30 | cortex_compactor_meta_sync_duration_seconds_bucket{le="1"} 2 |
| 31 | cortex_compactor_meta_sync_duration_seconds_bucket{le="10"} 3 |
| 32 | cortex_compactor_meta_sync_duration_seconds_bucket{le="100"} 3 |
| 33 | cortex_compactor_meta_sync_duration_seconds_bucket{le="300"} 3 |
| 34 | cortex_compactor_meta_sync_duration_seconds_bucket{le="600"} 3 |
| 35 | cortex_compactor_meta_sync_duration_seconds_bucket{le="1000"} 3 |
| 36 | cortex_compactor_meta_sync_duration_seconds_bucket{le="+Inf"} 3 |
| 37 | cortex_compactor_meta_sync_duration_seconds_sum 4.444 |
| 38 | cortex_compactor_meta_sync_duration_seconds_count 3 |
| 39 | # HELP cortex_compactor_meta_sync_failures_total Total blocks metadata synchronization failures. |
| 40 | # TYPE cortex_compactor_meta_sync_failures_total counter |
| 41 | cortex_compactor_meta_sync_failures_total 33330 |
| 42 | # HELP cortex_compactor_meta_synced Number of block metadata synced |
| 43 | # TYPE cortex_compactor_meta_synced gauge |
| 44 | cortex_compactor_meta_synced{state="corrupted-meta-json"} 0 |
| 45 | cortex_compactor_meta_synced{state="duplicate"} 0 |
| 46 | cortex_compactor_meta_synced{state="failed"} 0 |
| 47 | cortex_compactor_meta_synced{state="label-excluded"} 0 |
| 48 | cortex_compactor_meta_synced{state="loaded"} 0 |
| 49 | cortex_compactor_meta_synced{state="marked-for-deletion"} 0 |
| 50 | cortex_compactor_meta_synced{state="marked-for-no-compact"} 0 |
| 51 | cortex_compactor_meta_synced{state="no-meta-json"} 0 |
| 52 | cortex_compactor_meta_synced{state="parquet-migrated"} 0 |
| 53 | cortex_compactor_meta_synced{state="time-excluded"} 0 |
| 54 | cortex_compactor_meta_synced{state="too-fresh"} 0 |
| 55 | # HELP cortex_compactor_meta_syncs_total Total blocks metadata synchronization attempts. |
| 56 | # TYPE cortex_compactor_meta_syncs_total counter |
| 57 | cortex_compactor_meta_syncs_total 22220 |
| 58 | # HELP cortex_compact_group_compaction_planned_total Total number of compaction planned. |
| 59 | # TYPE cortex_compact_group_compaction_planned_total counter |
| 60 | cortex_compact_group_compaction_planned_total{user="aaa"} 211090 |
| 61 | cortex_compact_group_compaction_planned_total{user="bbb"} 222200 |
| 62 | cortex_compact_group_compaction_planned_total{user="ccc"} 233310 |
| 63 | # HELP cortex_compactor_blocks_marked_for_deletion_total Total number of blocks marked for deletion in compactor. |
| 64 | # TYPE cortex_compactor_blocks_marked_for_deletion_total counter |
| 65 | cortex_compactor_blocks_marked_for_deletion_total{reason="compaction",user="aaa"} 144430 |
| 66 | cortex_compactor_blocks_marked_for_deletion_total{reason="compaction",user="bbb"} 155540 |
| 67 | cortex_compactor_blocks_marked_for_deletion_total{reason="compaction",user="ccc"} 166650 |
| 68 | # HELP cortex_compactor_garbage_collected_blocks_total Total number of blocks marked for deletion by compactor. |
| 69 | # TYPE cortex_compactor_garbage_collected_blocks_total counter |
nothing calls this directly
no test coverage detected