Commit 4521487
authored
Add metrics tracking time to restore a database from disk (#3285)
# Description of Changes
Inspired by a question @Shubham8287 asked me: how long does it take to
replay real production databases, e.g. a BitCraft region module? I did
not have a good answer, and didn't know how I could get an answer.
Add 5 new metrics:
- `replay_total_time_seconds(db: Identity)`, total time to read and
restore snapshot and replay commitlog.
- `replay_snapshot_read_time_seconds(db: Identity)`, time to read
snapshot from disk.
- `replay_snapshot_restore_time_seconds(db: Identity)`, time to restore
snapshot once it's already in memory.
- `replay_commitlog_time_seconds(db: Identity)`, time to replay
commitlog once snapshot is restored.
- `replay_commitlog_num_commits(db: Identity)`, number of commits
visited during commitlog replay, i.e. the length of the suffix after the
most recent usable snapshot.
All of these are `Gauge`s (or `IntGauge` for the `num_commits` metric),
as we expect observations to be very infrequent
(approx. once per label value per SpacetimeDB process).
# API and ABI breaking changes
N/a
# Expected complexity level and risk
1
# Testing
I remain unsure how to test metrics. This won't break anything, though,
so I'm not worried.1 parent 75f043a commit 4521487
2 files changed
Lines changed: 71 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
381 | 385 | | |
382 | 386 | | |
383 | 387 | | |
| |||
387 | 391 | | |
388 | 392 | | |
389 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
390 | 401 | | |
391 | 402 | | |
392 | 403 | | |
| |||
532 | 543 | | |
533 | 544 | | |
534 | 545 | | |
| 546 | + | |
535 | 547 | | |
536 | 548 | | |
537 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
538 | 558 | | |
539 | | - | |
540 | | - | |
541 | | - | |
| 559 | + | |
542 | 560 | | |
543 | 561 | | |
544 | 562 | | |
| |||
554 | 572 | | |
555 | 573 | | |
556 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
557 | 579 | | |
558 | | - | |
559 | | - | |
560 | | - | |
| 580 | + | |
561 | 581 | | |
562 | 582 | | |
563 | 583 | | |
| |||
1602 | 1622 | | |
1603 | 1623 | | |
1604 | 1624 | | |
| 1625 | + | |
| 1626 | + | |
1605 | 1627 | | |
1606 | | - | |
| 1628 | + | |
1607 | 1629 | | |
1608 | | - | |
| 1630 | + | |
1609 | 1631 | | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
1610 | 1645 | | |
1611 | 1646 | | |
1612 | 1647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
287 | 315 | | |
288 | 316 | | |
289 | 317 | | |
| |||
0 commit comments