-
Notifications
You must be signed in to change notification settings - Fork 146
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
fix: do not check for rails console #574
Conversation
Some Rails applications may have Rails::Console defined (possibly through gems). This would inadvertantly disable Insights in production. The issue with this is that this will enable Insights in legitimate consoles, so we'll need to document how to disable it via ENV variables perhaps.
@@ -71,16 +71,18 @@ def self.source_ignored?(source) | |||
end | |||
|
|||
Plugin.register :rails do | |||
requirement { config.load_plugin_insights?(:rails_metrics) && defined?(::Rails.application) && ::Rails.application } |
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.
This should have been :rails
and not :rails_metrics
, but this is more of a naming thing and wouldn't have broken anything.
::ActiveSupport::Notifications.subscribe("sql.active_record", Honeybadger::ActiveRecordSubscriber.new) | ||
::ActiveSupport::Notifications.subscribe("process.action_mailer", Honeybadger::ActionMailerSubscriber.new) | ||
::ActiveSupport::Notifications.subscribe(/(service_upload|service_download)\.active_storage/, Honeybadger::ActiveStorageSubscriber.new) | ||
if config.load_plugin_insights?(:rails) |
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.
cleanup: making the check here instead
@@ -277,7 +277,6 @@ def load_plugin?(name) | |||
end | |||
|
|||
def insights_enabled? | |||
return false if defined?(::Rails.application) && ::Rails.const_defined?("Console") |
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.
::Rails.const_defined?("Console")
was always a bit finnicky to me to determine if we are in a console or not. I'm opting to just remove it for now until there is a better way to detect it automatically.
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.
LGTM
Some Rails applications may have Rails::Console defined (possibly through gems). This would inadvertantly disable Insights in production. The issue with this is that this will enable Insights in legitimate consoles, so we'll need to document how to disable it via ENV variables perhaps.
Disable Insights when starting a Rails console:
Before submitting a pull request, please make sure the following is done:
rake spec
in the repository root.