-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ENH]: Add spann metrics #4492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH]: Add spann metrics #4492
Conversation
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Instrumentation of SPANN Operations with Detailed Metrics This PR adds comprehensive metrics instrumentation to SPANN index operations, particularly during compaction processes. It implements counters and histograms for various operations like reassignments, splits, head creation/deletion, and measures latency for key operations. The PR moves stopwatch functionality to a shared utility and ensures metrics are properly tracked throughout the compaction lifecycle. Key Changes: Affected Areas: Potential Impact: Functionality: No changes to core functionality, but enhances observability of SPANN operations Performance: Minimal overhead from metrics collection, with performance data now available for analysis Security: No security implications Scalability: Helps diagnose scalability issues by providing visibility into compaction bottlenecks Review Focus: Testing Needed• Verify metrics are properly emitted during compaction operations Code Quality Assessmentrust/tracing/src/util.rs: Good encapsulation of the Stopwatch functionality rust/blockstore/src/types/flusher.rs: Potential issue with unimplemented!() in num_entries() method for MemoryBlockfileFlusher rust/index/src/spann/types.rs: File has become significantly larger and could benefit from refactoring into multiple files Best PracticesMetrics: Rust: Potential Issues• The num_entries() method uses unimplemented!() for MemoryBlockfileFlusher which could cause runtime panics This summary was automatically generated by @propel-code-bot |
|
||
pub fn num_blocks(&self) -> usize { | ||
match self { | ||
BlockfileFlusher::MemoryBlockfileFlusher(_) => unimplemented!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CriticalError]
The num_blocks
method for BlockfileFlusher::MemoryBlockfileFlusher
uses unimplemented!()
. If a SpannIndexFlusher
(from chroma-index
) is created with MemoryBlockfileFlusher
instances, which is possible if SPANN uses in-memory blockfiles, calling flush()
on SpannIndexFlusher
will invoke num_blocks()
on these memory flushers (e.g., in SpannIndexFlusher::flush
when calculating num_pl_blocks_flushed
). This will lead to a panic.
Consider returning a value that is semantically correct for in-memory flushers. If "flushed blocks" primarily refers to units written to persistent storage, 0
might be appropriate. If it represents a conceptual block, 1
could be an alternative. Returning 0
seems safer to prevent panics and align with the idea of blocks flushed to disk.
BlockfileFlusher::MemoryBlockfileFlusher(_) => unimplemented!(), | |
BlockfileFlusher::MemoryBlockfileFlusher(_) => 0, |
⚡ Committable suggestion
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
c45b732
to
81006ee
Compare
81006ee
to
4dd9814
Compare
4dd9814
to
d3ac39a
Compare
## Description of changes _Summarize the changes made by this PR._ - Improvements & Bug fixes - Adds metrics for various operations during compaction - New functionality - ... ## Test plan _How are these changes tested?_ - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes None
## Description of changes _Summarize the changes made by this PR._ - Improvements & Bug fixes - Adds metrics for various operations during compaction - New functionality - ... ## Test plan _How are these changes tested?_ - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes None
Description of changes
Summarize the changes made by this PR.
Test plan
How are these changes tested?
pytest
for python,yarn test
for js,cargo test
for rustDocumentation Changes
None