-
Notifications
You must be signed in to change notification settings - Fork 2k
[ENH] Do not trace failed preconditions when flushing compaction. #5155
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
Conversation
The soft-deleted compaction will return an error that's not distinguishable from other errors. It will percolate to the dispatcher and be logged like every other error. In #5064, we added a should_trace_error function on the chroma Error trait, which will silence the error at the dispatcher. This PR applies that annotation to the failed precondition.
|
This PR updates the FlushCompactionError implementation so that failed precondition errors-typically raised in cases like soft-deleted compactions-are not traced as errors in the dispatcher, reducing unnecessary logging and paging. This leverages the recently added should_trace_error function in the ChromaError trait to control which errors are surfaced for tracing. This summary was automatically generated by @propel-code-bot |
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
| FlushCompactionError::FailedToFlushCompaction(status) => { | ||
| if std::convert::Into::<chroma_error::ErrorCodes>::into(status.code()) | ||
| == ErrorCodes::FailedPrecondition | ||
| { | ||
| ErrorCodes::FailedPrecondition | ||
| } else { | ||
| ErrorCodes::Internal | ||
| } | ||
| } |
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.
[BestPractice]
You can simplify the type conversion here. The compiler can infer the type for .into() from the comparison with ErrorCodes::FailedPrecondition, making the explicit type annotation unnecessary.
| FlushCompactionError::FailedToFlushCompaction(status) => { | |
| if std::convert::Into::<chroma_error::ErrorCodes>::into(status.code()) | |
| == ErrorCodes::FailedPrecondition | |
| { | |
| ErrorCodes::FailedPrecondition | |
| } else { | |
| ErrorCodes::Internal | |
| } | |
| } | |
| FlushCompactionError::FailedToFlushCompaction(status) => { | |
| if status.code().into() == ErrorCodes::FailedPrecondition { | |
| ErrorCodes::FailedPrecondition | |
| } else { | |
| ErrorCodes::Internal | |
| } | |
| } |
⚡ 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.
codetheweb
left a comment
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.
I didn't see should_trace_error and honestly am having a little trouble understanding it. In my mind there are only two cases: either the result is an error and we should error!/trace, or the result is something we expect to happen under normal conditions. In other words, I'm not quite getting why we push an idea of "nominal"/expected error conditions down into the trait.
|
I added should_trace_error a few weeks ago. The core problem is that the In general I disagree with tracing every error, but that's not for this PR. |
…roma-core#5155) ## Description of changes The soft-deleted compaction will return an error that's not distinguishable from other errors. It will percolate to the dispatcher and be logged like every other error. In chroma-core#5064, we added a should_trace_error function on the chroma Error trait, which will silence the error at the dispatcher. This PR applies that annotation to the failed precondition. ## Test plan CI ## Migration plan N/A ## Observability plan We get paged today. We don't get paged in the future. ## Documentation Changes N/A
Description of changes
The soft-deleted compaction will return an error that's not
distinguishable from other errors. It will percolate to the dispatcher
and be logged like every other error.
In #5064, we added a should_trace_error function on the chroma Error
trait, which will silence the error at the dispatcher. This PR applies
that annotation to the failed precondition.
Test plan
CI
Migration plan
N/A
Observability plan
We get paged today.
We don't get paged in the future.
Documentation Changes
N/A