client-api: stop logging suspended-database errors as 500s#4918
Open
client-api: stop logging suspended-database errors as 500s#4918
Conversation
The two leader() call sites in database.rs and subscribe.rs were piping GetLeaderHostError through log_and_500, which logs every variant at error level and forces a 500 response. GetLeaderHostError already implements Into<axum::response::ErrorResponse> with proper status codes (503 for Suspended/Bootstrapping/NoLeader/NoNodeId/ControlConnection, 404 for NoSuchDatabase, 500 for LaunchError/Misdirected), and standalone already uses ?-propagation directly. Match that pattern so suspended databases no longer log at error level and return the correct 503 status.
b0bf9c2 to
548b28d
Compare
kim
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Disclaimer: This description was written by claude:
The two
.leader()call sites inclient-api/src/routes/database.rsandclient-api/src/routes/subscribe.rspipeGetLeaderHostErrorthroughlog_and_500, which:errorlevel — includingSuspended,Bootstrapping,NoLeader, etc., which are normal operational states. This produces noisy log lines like:GetLeaderHostErroralready implementsInto<axum::response::ErrorResponse>with the correct per-variant mapping:NoSuchDatabaseLaunchError,MisdirectedNoNodeId,NoLeader,ControlConnection,Suspended,BootstrappingThe standalone implementation already uses
?-propagation directly. This PR makes the two client-api call sites match that pattern.Result
error-level log spam in the request path. Genuinely unexpected internal errors elsewhere in the codebase continue to log vialog_and_500unchanged.API and ABI breaking changes
None
Expected complexity level and risk
1
Testing