lib/sentry/rails/railtie.rb in sentry-rails-4.3.4 vs lib/sentry/rails/railtie.rb in sentry-rails-4.4.0.pre.beta.0
- old
+ new
@@ -4,12 +4,12 @@
module Sentry
class Railtie < ::Rails::Railtie
# middlewares can't be injected after initialize
initializer "sentry.use_rack_middleware" do |app|
- # need to be placed at first to capture as many errors as possible
- app.config.middleware.insert 0, Sentry::Rails::CaptureExceptions
+ # placed after all the file-sending middlewares so we can avoid unnecessary transactions
+ app.config.middleware.insert_after ActionDispatch::Executor, Sentry::Rails::CaptureExceptions
# need to be placed at last to smuggle app exceptions via env
app.config.middleware.use(Sentry::Rails::RescuedExceptionInterceptor)
end
config.after_initialize do |app|
@@ -19,11 +19,10 @@
configure_trusted_proxies
extend_controller_methods if defined?(ActionController)
extend_active_job if defined?(ActiveJob)
patch_background_worker if defined?(ActiveRecord)
override_streaming_reporter if defined?(ActionView)
- override_file_handler if defined?(ActionDispatch) && app.config.public_file_server.enabled
setup_backtrace_cleanup_callback
inject_breadcrumbs_logger
activate_tracing
end
@@ -77,19 +76,13 @@
ActiveSupport.on_load :action_view do
ActionView::StreamingTemplateRenderer::Body.send(:prepend, Sentry::Rails::Overrides::StreamingReporter)
end
end
- def override_file_handler
- require "sentry/rails/overrides/file_handler"
-
- ActiveSupport.on_load :action_controller do
- ActionDispatch::FileHandler.send(:prepend, Sentry::Rails::Overrides::FileHandler)
- end
- end
-
def activate_tracing
if Sentry.configuration.tracing_enabled?
+ subscribers = Sentry.configuration.rails.tracing_subscribers
+ Sentry::Rails::Tracing.register_subscribers(subscribers)
Sentry::Rails::Tracing.subscribe_tracing_events
Sentry::Rails::Tracing.patch_active_support_notifications
end
end
end