Skip to content
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

Enable Rails 7 error reporter via Rollbar config #1161

Merged
merged 5 commits into from
Aug 30, 2024

Conversation

waltjones
Copy link
Contributor

@waltjones waltjones commented Aug 26, 2024

Description of the change

Optionally enables the Rails 7 error reporter. https://edgeguides.rubyonrails.org/error_reporting.html

The new Boolean config key is enable_rails_error_subscriber.

      Rollbar.configure do |config|
        config.enable_rails_error_subscriber = true
      end

This is off by default for back compatibility, and can be enabled in the Rollbar initializer, or enabled/disabled at any time via the Rollbar.configure method.

This is available with Rails 7.1+ because that's when unsubscribe was introduced.

This PR also fixes an issue with the Rollbar::Logger class.

  • initialize should call super. This issue breaks in recent Logger versions.
  • The Logger version should be used to branch in tests.

Normally I'd put this in a separate PR, but since it breaks CI I've added it here.

Note: This PR also enables both hash syntaxes in rubocop.

Type of change

  • New feature (non-breaking change that adds functionality)

Related issues

Fixes:
#1105
#1153
#1156

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

@waltjones waltjones force-pushed the waltjones/rails-error-reporter branch from c6d966f to 49210c8 Compare August 26, 2024 15:50
Copy link

@matux matux left a comment

Choose a reason for hiding this comment

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

Just two small comments

lib/rollbar/exception_reporter.rb Show resolved Hide resolved
lib/rollbar/plugins/rails/error_subscriber.rb Show resolved Hide resolved
@matux matux self-requested a review August 27, 2024 14:33
Copy link

@matux matux left a comment

Choose a reason for hiding this comment

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

Looks awesome!

@waltjones waltjones merged commit f9d0be7 into master Aug 30, 2024
25 checks passed
@dcrec1
Copy link

dcrec1 commented Sep 10, 2024

When used with Sidekiq, this reports a lot of Sidekiq::JobRetry::Handled errors that can't be filtered. Is this expected?

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