(t *testing.T)
| 299 | } |
| 300 | |
| 301 | func TestTSDBMetrics(t *testing.T) { |
| 302 | mainReg := prometheus.NewPedanticRegistry() |
| 303 | |
| 304 | tsdbMetrics := newTSDBMetrics(mainReg) |
| 305 | |
| 306 | tsdbMetrics.setRegistryForUser("user1", populateTSDBMetrics(12345)) |
| 307 | tsdbMetrics.setRegistryForUser("user2", populateTSDBMetrics(85787)) |
| 308 | tsdbMetrics.setRegistryForUser("user3", populateTSDBMetrics(999)) |
| 309 | |
| 310 | err := testutil.GatherAndCompare(mainReg, bytes.NewBufferString(` |
| 311 | # HELP cortex_ingester_shipper_dir_syncs_total Total number of TSDB dir syncs |
| 312 | # TYPE cortex_ingester_shipper_dir_syncs_total counter |
| 313 | # 12345 + 85787 + 999 |
| 314 | cortex_ingester_shipper_dir_syncs_total 99131 |
| 315 | |
| 316 | # HELP cortex_ingester_shipper_dir_sync_failures_total Total number of failed TSDB dir syncs |
| 317 | # TYPE cortex_ingester_shipper_dir_sync_failures_total counter |
| 318 | # 2*(12345 + 85787 + 999) |
| 319 | cortex_ingester_shipper_dir_sync_failures_total 198262 |
| 320 | |
| 321 | # HELP cortex_ingester_shipper_uploads_total Total number of uploaded TSDB blocks |
| 322 | # TYPE cortex_ingester_shipper_uploads_total counter |
| 323 | # 3*(12345 + 85787 + 999) |
| 324 | cortex_ingester_shipper_uploads_total 297393 |
| 325 | |
| 326 | # HELP cortex_ingester_shipper_upload_failures_total Total number of TSDB block upload failures |
| 327 | # TYPE cortex_ingester_shipper_upload_failures_total counter |
| 328 | # 4*(12345 + 85787 + 999) |
| 329 | cortex_ingester_shipper_upload_failures_total 396524 |
| 330 | |
| 331 | # HELP cortex_ingester_shipper_corrupted_blocks_total Total number of TSDB blocks corrupted |
| 332 | # TYPE cortex_ingester_shipper_corrupted_blocks_total counter |
| 333 | # 30*(12345 + 85787 + 999) |
| 334 | cortex_ingester_shipper_corrupted_blocks_total 2973930 |
| 335 | |
| 336 | # HELP cortex_ingester_tsdb_compactions_total Total number of TSDB compactions that were executed. |
| 337 | # TYPE cortex_ingester_tsdb_compactions_total counter |
| 338 | cortex_ingester_tsdb_compactions_total 693917 |
| 339 | |
| 340 | # HELP cortex_ingester_tsdb_compaction_duration_seconds Duration of TSDB compaction runs. |
| 341 | # TYPE cortex_ingester_tsdb_compaction_duration_seconds histogram |
| 342 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="1"} 0 |
| 343 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="2"} 0 |
| 344 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="4"} 0 |
| 345 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="8"} 0 |
| 346 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="16"} 3 |
| 347 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="32"} 3 |
| 348 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="64"} 3 |
| 349 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="128"} 3 |
| 350 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="256"} 3 |
| 351 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="512"} 3 |
| 352 | cortex_ingester_tsdb_compaction_duration_seconds_bucket{le="+Inf"} 3 |
| 353 | cortex_ingester_tsdb_compaction_duration_seconds_sum 27 |
| 354 | cortex_ingester_tsdb_compaction_duration_seconds_count 3 |
| 355 | |
| 356 | # HELP cortex_ingester_tsdb_wal_fsync_duration_seconds Duration of TSDB WAL fsync. |
| 357 | # TYPE cortex_ingester_tsdb_wal_fsync_duration_seconds summary |
| 358 | cortex_ingester_tsdb_wal_fsync_duration_seconds{quantile="0.5"} 30 |
nothing calls this directly
no test coverage detected