Commit c838ed5
committed
Improve snapshot compression metrics
Report more metrics about snapshot compression, namely:
- time to compress a single snapshot (histogram)
- for each compression pass:
- number of snapshots found to be already compressed (gauge)
- number of snapshots compressed (gauge)
- cumulative number of objects compressed (gauge)
- cumulative number of objects hardlinked (gauge)
Those metrics are collected from the `spacetimedb-snapshot` crate
without imposing a prometheus dependency on it, i.e. they can be
observed by the caller as ordinary Rust types.
This is exploited to avoid scanning the entire snapshot repository on
each pass -- only the range `(last_compressed + 1)..newest_snapshot` is
visited (note that the `compress_snapshots` method now short-circuits on
errors).
Lastly, the snapshot worker can now be configured to disable
compression. This greatly simplifies implementation of alternative
post-processing strategies, e.g. involving archival, for which a more
coarse-grained compression strategy may be more appropriate.
Subcribers are notified of a new snapshot _after_ compression, such that
any filesystem locks should be released.1 parent c60bfe6 commit c838ed5
File tree
8 files changed
+426
-145
lines changed- crates
- core/src
- db
- worker_metrics
- datastore/src/locking_tx_datastore
- fs-utils/src
- snapshot
- src
- tests
8 files changed
+426
-145
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1664 | 1664 | | |
1665 | 1665 | | |
1666 | 1666 | | |
| 1667 | + | |
1667 | 1668 | | |
1668 | 1669 | | |
1669 | 1670 | | |
| |||
1813 | 1814 | | |
1814 | 1815 | | |
1815 | 1816 | | |
1816 | | - | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
1817 | 1821 | | |
1818 | 1822 | | |
1819 | 1823 | | |
| |||
1951 | 1955 | | |
1952 | 1956 | | |
1953 | 1957 | | |
1954 | | - | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
1955 | 1962 | | |
1956 | 1963 | | |
1957 | 1964 | | |
| |||
2120 | 2127 | | |
2121 | 2128 | | |
2122 | 2129 | | |
2123 | | - | |
| 2130 | + | |
2124 | 2131 | | |
2125 | 2132 | | |
2126 | 2133 | | |
| |||
2129 | 2136 | | |
2130 | 2137 | | |
2131 | 2138 | | |
| 2139 | + | |
2132 | 2140 | | |
2133 | 2141 | | |
2134 | 2142 | | |
| |||
3142 | 3150 | | |
3143 | 3151 | | |
3144 | 3152 | | |
3145 | | - | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
3146 | 3156 | | |
3147 | 3157 | | |
3148 | 3158 | | |
| |||
3154 | 3164 | | |
3155 | 3165 | | |
3156 | 3166 | | |
3157 | | - | |
| 3167 | + | |
3158 | 3168 | | |
3159 | 3169 | | |
3160 | 3170 | | |
| |||
3204 | 3214 | | |
3205 | 3215 | | |
3206 | 3216 | | |
3207 | | - | |
| 3217 | + | |
3208 | 3218 | | |
3209 | 3219 | | |
3210 | 3220 | | |
| |||
0 commit comments