clockworklabs / clockworklabs/SpacetimeDB
Metric `rdb_iter_time` has a bug
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
@joshua-spacetime
I believe that this code executes as follows:
- A guard is created, starting timing for the
db::Iteriterator. - An iterator is constructed.
- The end of the function is reached, so the guard is dropped, ending timing for the iterator.
- The iterator is returned.
- The client actually drives the iterator to completion.
To fix this, the guard needs to be embedded in the db::Iter struct itself. This hopefully won't be hairy, the HistogramTimer struct has no lifetimes, is Send, Sync, etc.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/core/src/db/relational_db.rs lines 492-501 and trace how the db::Iter is constructed and returned. Check when HistogramTimer is dropped relative to iteration, then ensure the iterator owns the timer so timing covers client-driven iteration; verify the resulting metric behavior with the repository's relevant checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases, observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100