Skip to content

Fix kombu crash when using sentry & setting parsing#1359

Merged
TimPansino merged 11 commits intomainfrom
fix-kombu-sentry-crash
Apr 24, 2025
Merged

Fix kombu crash when using sentry & setting parsing#1359
TimPansino merged 11 commits intomainfrom
fix-kombu-sentry-crash

Conversation

@hmstepanek
Copy link
Contributor

@hmstepanek hmstepanek commented Apr 17, 2025

Overview

Because Sentry applies a proxy wrapper around the Producer.publish method, when we tried to apply the bind_args, it did not pickup the wrapped signature correctly-the instance was missing and so the value for the body was set as the value of self. Instead use a hardcoded bind to avoid this issue.

Fix missing parsing of config file instrumentation settings.

This is a fix for #1347.

@hmstepanek hmstepanek requested a review from a team as a code owner April 17, 2025 00:46
@github-actions
Copy link

github-actions bot commented Apr 17, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 6 0 0 0.47s
✅ MARKDOWN markdownlint 7 0 0 0 0.99s
✅ MARKDOWN markdown-link-check 7 0 0 9.2s
✅ PYTHON ruff 893 0 0 0 0.59s
✅ PYTHON ruff-format 893 0 0 0 0.27s
✅ YAML prettier 13 0 0 0 1.09s
✅ YAML v8r 13 0 0 4.64s
✅ YAML yamllint 13 0 0 0.56s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@mergify mergify bot added the tests-failing Tests failing in CI. label Apr 17, 2025
@codecov-commenter
Copy link

codecov-commenter commented Apr 17, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.90%. Comparing base (911aeee) to head (a54a93d).

Files with missing lines Patch % Lines
newrelic/hooks/messagebroker_kombu.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1359      +/-   ##
==========================================
+ Coverage   79.46%   79.90%   +0.44%     
==========================================
  Files         204      204              
  Lines       22832    22842      +10     
  Branches     3618     3618              
==========================================
+ Hits        18144    18253     +109     
+ Misses       3500     3392     -108     
- Partials     1188     1197       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify mergify bot removed the tests-failing Tests failing in CI. label Apr 17, 2025
@hmstepanek hmstepanek changed the title Fix kombu crash when using sentry Fix kombu crash when using sentry & setting parsing Apr 17, 2025
@mergify mergify bot added tests-failing Tests failing in CI. merge-conflicts Merge conflicts detected. labels Apr 21, 2025
return wrapped(*args, **kwargs)

bound_args = bind_args(wrapped, args, kwargs)
bound_args = bind_publish(*args, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bound_args = bind_publish(*args, **kwargs)
try:
bound_args = bind_publish(*args, **kwargs)
except Exception:
bound_args = None
if not bound_args:
return wrapped(*args, **kwargs)

I'm worried this will crash on other versions of Kombu since we only test the latest. Can we wrap it in a try/except clause like so?

This could use an exception message logged to debug as well.

@mergify mergify bot removed merge-conflicts Merge conflicts detected. tests-failing Tests failing in CI. labels Apr 21, 2025
@mergify mergify bot added the tests-failing Tests failing in CI. label Apr 22, 2025
@hmstepanek hmstepanek force-pushed the fix-kombu-sentry-crash branch from 5ca3e3f to 164015e Compare April 22, 2025 22:39
@hmstepanek hmstepanek requested a review from TimPansino April 22, 2025 22:55
TimPansino
TimPansino previously approved these changes Apr 22, 2025
@TimPansino TimPansino merged commit a330873 into main Apr 24, 2025
57 of 59 checks passed
@TimPansino TimPansino deleted the fix-kombu-sentry-crash branch April 24, 2025 18:42
@mergify mergify bot removed the tests-failing Tests failing in CI. label Apr 24, 2025
@TimPansino TimPansino added this to the v10.10.0 milestone Apr 24, 2025
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.

3 participants