Skip to content

Conversation

@lucasmazza
Copy link
Contributor

@lucasmazza lucasmazza commented Sep 15, 2025

Description

Adds a report_errors_via_rails config to sentry-sidekiq to fix #2698. When this is enabled, exceptions reported by the Sidekiq error handler will first go through Rails.error (and Rails::Sentry::ErrorSubscriber) before being sent to Sentry.

This allow exceptions from Sidekiq jobs to use the same context from Rails.error.set_context or Rails.error.add_middleware (available on Rails 8.1+)

Fixes RUBY-92

cursor[bot]

This comment was marked as outdated.

@lucasmazza
Copy link
Contributor Author

I'm testing this with our Rails app but the solution isn't quite there yet - Rails reporter is ignoring the exception because the retry check has marked it as @__rails_error_reported somehow :/

@lucasmazza lucasmazza force-pushed the lm/sidekiq-report-via-rails branch from 23857f9 to 75b5ac9 Compare September 23, 2025 13:27
@dingsdax dingsdax self-requested a review September 26, 2025 09:16
@solnic
Copy link
Collaborator

solnic commented Oct 17, 2025

Rails reporter is ignoring the exception because the retry check has marked it as @__rails_error_reported somehow :/

@lucasmazza did you manage to figure it out?

@lucasmazza
Copy link
Contributor Author

@solnic nope - I couldn't figure this out and changed our app code to stop using Rails.error.set_context and use Sentry.set_context directly.

@dingsdax dingsdax removed their request for review October 22, 2025 16:04
@lucasmazza lucasmazza closed this Oct 22, 2025
@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.31%. Comparing base (611ef73) to head (75b5ac9).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2701   +/-   ##
=======================================
  Coverage   97.31%   97.31%           
=======================================
  Files         144      144           
  Lines        5657     5664    +7     
=======================================
+ Hits         5505     5512    +7     
  Misses        152      152           
Components Coverage Δ
sentry-ruby 97.78% <ø> (ø)
sentry-rails 95.61% <ø> (ø)
sentry-sidekiq 96.66% <100.00%> (+0.08%) ⬆️
sentry-resque 94.44% <ø> (ø)
sentry-delayed_job 94.68% <ø> (ø)
sentry-opentelemetry 99.31% <ø> (ø)
Files with missing lines Coverage Δ
sentry-sidekiq/lib/sentry/sidekiq/configuration.rb 100.00% <100.00%> (ø)
sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb 95.45% <100.00%> (+0.58%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Report Sidekiq errors via Rails.error

2 participants