Skip to content

fix(logging): Send raw logging parameters #4291

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

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

szokeasaurusrex
Copy link
Member

@szokeasaurusrex szokeasaurusrex commented Apr 14, 2025

This reverts commit 4c9731b, adding tests to ensure the correct behavior going forward.

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 (which we have not been doing yet). I will open a follow-up PR to do this.

Fixes #4267

@szokeasaurusrex szokeasaurusrex requested a review from a team as a code owner April 14, 2025 16:04
@szokeasaurusrex szokeasaurusrex requested review from antonpirker and removed request for a team April 14, 2025 16:04
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.53%. Comparing base (a3d4b89) to head (e71ccbf).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4291      +/-   ##
==========================================
+ Coverage   79.50%   79.53%   +0.03%     
==========================================
  Files         142      142              
  Lines       15907    15907              
  Branches     2723     2722       -1     
==========================================
+ Hits        12647    12652       +5     
+ Misses       2391     2389       -2     
+ Partials      869      866       -3     
Files with missing lines Coverage Δ
sentry_sdk/integrations/logging.py 82.89% <ø> (ø)

... and 2 files with indirect coverage changes

Verified

This commit was signed with the committer’s verified signature.
szokeasaurusrex Daniel Szoke
This reverts commit 4c9731b, adding tests to ensure the correct behavior going forward.

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
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/send-raw-logging-args branch from f327c77 to e71ccbf Compare April 14, 2025 16:20
szokeasaurusrex added a commit that referenced this pull request Apr 14, 2025

Verified

This commit was signed with the committer’s verified signature.
szokeasaurusrex Daniel Szoke
Send the formatted log event to Sentry in the [`formatted` field](https://develop.sentry.dev/sdk/data-model/event-payloads/message/).

This builds on #4291, providing a more robust fix for #3660.
szokeasaurusrex added a commit that referenced this pull request Apr 15, 2025

Verified

This commit was signed with the committer’s verified signature.
szokeasaurusrex Daniel Szoke
Send the formatted log event to Sentry in the [`formatted` field](https://develop.sentry.dev/sdk/data-model/event-payloads/message/).

This builds on #4291, providing a more robust fix for #3660.
szokeasaurusrex added a commit that referenced this pull request Apr 15, 2025

Verified

This commit was signed with the committer’s verified signature.
szokeasaurusrex Daniel Szoke
The way the code was written before this change made it look like log records from the `warnings` module were always being handled by a separate code path. In fact, this separate path is only used for Python 3.10 and below.

This change makes it clear that the branch is version specific. That way, when we eventually stop supporting 3.10, it is clear that we can delete this separate block.

Depends on:
  - #4292
  - #4291
@szokeasaurusrex szokeasaurusrex merged commit e71ccbf into master Apr 15, 2025
138 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/send-raw-logging-args branch April 15, 2025 08:56
szokeasaurusrex added a commit that referenced this pull request Apr 15, 2025

Verified

This commit was signed with the committer’s verified signature.
szokeasaurusrex Daniel Szoke
The way the code was written before this change made it look like log records from the `warnings` module were always being handled by a separate code path. In fact, this separate path is only used for Python 3.10 and below.

This change makes it clear that the branch is version specific. That way, when we eventually stop supporting 3.10, it is clear that we can delete this separate block.

Depends on:
  - #4292
  - #4291
antonpirker pushed a commit that referenced this pull request Apr 15, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
The way the code was written before this change made it look like log
records from the `warnings` module were always being handled by a
separate code path. In fact, this separate path is only used for Python
3.10 and below.

This change makes it clear that the branch is version specific. That
way, when we eventually stop supporting 3.10, it is clear that we can
delete this separate block.

Depends on:
  - #4292
  - #4291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log formatting with %s now can't output dicts
2 participants