-
Notifications
You must be signed in to change notification settings - Fork 150
feat: add Rails.event subscriber #734
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for subscribing to Rails.event notifications to send structured events to Honeybadger Insights. It introduces a new Rails event subscriber that captures events emitted via Rails.event.notify
and forwards them to Honeybadger's event system.
- Implements a new
RailsEventSubscriber
class to handle Rails.event notifications - Integrates the subscriber into the Rails plugin with conditional loading for Rails 8.1+ compatibility
- Adds comprehensive test coverage for both available and unavailable Rails.event scenarios
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
lib/honeybadger/plugins/rails.rb | Adds conditional subscription to Rails.event when available |
lib/honeybadger/notification_subscriber.rb | Implements RailsEventSubscriber class to process Rails events |
spec/integration/rails/event_subscriber_spec.rb | Adds test coverage for Rails event subscription functionality |
gemfiles/rails.gemfile | Simplifies Rails gem dependencies to use main branch |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this Rails feature
This takes a different approach than d3d2767 to get the latest rails gem versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is very cool.
The activerecord-jdbcsqlite3-adapter gem doesn't seem to be quite ready for Rails 8 yet.
Rails 8 requires Ruby 3.2 but JRuby 9 provides Ruby 3.1
I'm having second thoughts about the check for |
That config name is not screaming it, but I think that makes sense if we want to keep that just for "framework" events. It seems like we should provide a way to disable this though. |
Agreed, I was thinking this too. I could see cases where people might want to disable the automatic instrumentation, but still get |
@joshuap and @rabidpraxis what do you think about the new |
I like it, but I am wondering if |
I like the idea, but I agree that the insights config is getting pretty confusing with all the similarly named options. With this addition, these are the current insights options that would be relevant for Rails, right? {
"insights.enabled": {
description: "Enable/Disable Honeybadger Insights built-in instrumentation.",
default: true,
type: Boolean
},
"rails.insights.enabled": {
description: "Enable automatic data collection for Ruby on Rails.",
default: true,
type: Boolean
},
"rails.insights.events": {
description: "Enable automatic event capturing for Ruby on Rails.",
default: true,
type: Boolean
},
"rails.insights.metrics": {
description: "Enable automatic metric data collection for Ruby on Rails.",
default: false,
type: Boolean
},
"rails.insights.custom_events": {
description: "Enable capturing of custom Rails.event events in Rails 8.1 and later.",
default: true,
type: Boolean
}
}
---
rails:
insights:
events: false If you are new to Honeybadger, would you expect that option to disable |
Send events recorded by calling
Rails.event.notify
to Insights.See rails/rails#55334 for more info