Log driver API request deserialization errors#4358
Open
squadgazzz wants to merge 2 commits intomainfrom
Open
Conversation
Axum returns a terse 400 when a request body or query string fails to deserialize, which makes malformed caller payloads invisible in production. Add `LoggingJson` and `LoggingQuery` extractors that emit a `warn` with the serde error and the type being decoded, then delegate to axum's stock rejection so the HTTP response shape is unchanged. Wire the new extractors into `/settle`, `/reveal`, and `/quote`. Also warn on `/solve` body parse failures in `pre_processing.rs`.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces custom Axum extractors, LoggingJson and LoggingQuery, to provide warning logs when request deserialization fails across the quote, reveal, and settle API routes. Additionally, it adds error logging for solve request parsing within the pre-processing logic to improve observability of malformed requests. I have no feedback to provide.
jmg-duarte
approved these changes
Apr 24, 2026
Contributor
jmg-duarte
left a comment
There was a problem hiding this comment.
LGTM just add a brief doc
| serde::de::DeserializeOwned, | ||
| }; | ||
|
|
||
| pub struct LoggingJson<T>(pub T); |
Contributor
There was a problem hiding this comment.
Something like this
Suggested change
| pub struct LoggingJson<T>(pub T); | |
| /// Json extractor wrapping Axum's native one but logs deserialization errors | |
| pub struct LoggingJson<T>(pub T); |
| } | ||
| } | ||
|
|
||
| pub struct LoggingQuery<T>(pub T); |
Contributor
There was a problem hiding this comment.
Same as above but applied to query
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
Axum returns a terse 400 when a request body or query string fails to deserialize, which makes malformed caller payloads invisible in production.
Changes
LoggingJsonandLoggingQueryextractors that emit atracing::warn!with the serde error and the target type, then delegate to axum's stock rejection (HTTP response shape unchanged)./settle,/reveal, and/quote.tracing::warn!on/solvebody parse failures inpre_processing.rs.How to test
Existing tests.