Fix structlog JSON serialization crash on non-serializable objects#62656
Open
Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Open
Fix structlog JSON serialization crash on non-serializable objects#62656Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Conversation
Contributor
Author
|
cc @ashb @amoghrajesh @potiuk — Would appreciate your review. This adds a |
Wrap the enc_hook in json_dumps() with a safe_default() fallback that catches TypeError and falls back to str(). This prevents the logging pipeline from crashing when log event dicts contain objects that msgspec cannot serialize. Closes: apache#62472 Closes: apache#62201 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
087f1a6 to
3130064
Compare
Member
|
You need to (as always) add test to that change - including covering the case that crashed before from the linked issues. |
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.
Summary
enc_hookinjson_dumps()with asafe_default()fallback that catchesTypeErrorand falls back tostr()msgspeccannot serializeCo-contributors : @codingrealitylabs @girlcoder-gaming
Test plan
str()instead of crashingpytest task-sdk/tests/ -k log -vCloses: #62472
Closes: #62201
🤖 Generated with Claude Code