-
Notifications
You must be signed in to change notification settings - Fork 535
Log formatting with %s now can't output dicts #4267
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
Comments
Thanks for the report, we will investigate |
szokeasaurusrex
added a commit
that referenced
this issue
Apr 14, 2025
This reverts commit 4c9731b. That commit caused a regression when `record.args` contains a dictionary. Because we iterate over `record.args`, that change caused us to only send the dictionary's keys, not the values. A more robust fix for #3660 will be to send the formatted message in the [`formatted` field](https://develop.sentry.dev/sdk/data-model/event-payloads/message/) (which we have not been doing yet). I will open a follow-up PR to do this. Fixes #4267
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you use Sentry?
Self-hosted/on-premise
Version
2.23.0+
Steps to Reproduce
We've observed cases in open source where a dict is passed positionally to a logging call. A recent change in sentry means that
params
loses its dict-ness and is only keys by the time it gets tobefore_send
. This can result in "format requires a mapping" or "not all arguments converted during string formatting" exceptions.Use the following script: repro.txt
We're fairly certain that this comes from the change in 4c9731b which iterates the dict giving only the keys.
Examples where this pattern is used:
Expected Result
Run it with sentry-sdk==2.22.0 and it works fine:
Actual Result
If you run it with sentry-sdk==2.23.1 or newer, it's broken:
The text was updated successfully, but these errors were encountered: