class Sentry::Railtie

def activate_tracing

def activate_tracing
  if Sentry.configuration.tracing_enabled?
    Sentry::Rails::Tracing.subscribe_tracing_events
    Sentry::Rails::Tracing.patch_active_support_notifications
  end
end

def configure_project_root

def configure_project_root
  Sentry.configuration.project_root = ::Rails.root.to_s
end

def configure_sentry_logger

def configure_sentry_logger
  Sentry.configuration.logger = ::Rails.logger
end

def configure_trusted_proxies

def configure_trusted_proxies
  Sentry.configuration.trusted_proxies += Array(::Rails.application.config.action_dispatch.trusted_proxies)
end

def extend_active_job

def extend_active_job
  require "sentry/rails/active_job"
  ActiveJob::Base.send(:prepend, Sentry::Rails::ActiveJobExtensions)
end

def extend_controller_methods

def extend_controller_methods
  ActiveSupport.on_load :action_controller do
    include Sentry::Rails::ControllerMethods
    include Sentry::Rails::ControllerTransaction
    ActionController::Live.send(:prepend, Sentry::Rails::Overrides::StreamingReporter)
  end
end

def inject_breadcrumbs_logger

def inject_breadcrumbs_logger
  if Sentry.configuration.breadcrumbs_logger.include?(:active_support_logger)
    require 'sentry/rails/breadcrumb/active_support_logger'
    Sentry::Rails::Breadcrumb::ActiveSupportLogger.inject
  end
end

def override_file_handler

def override_file_handler
  ActiveSupport.on_load :action_controller do
    ActionDispatch::FileHandler.send(:prepend, Sentry::Rails::Overrides::FileHandler)
  end
end

def override_streaming_reporter

def override_streaming_reporter
  ActiveSupport.on_load :action_view do
    ActionView::StreamingTemplateRenderer::Body.send(:prepend, Sentry::Rails::Overrides::StreamingReporter)
  end
end

def setup_backtrace_cleanup_callback

def setup_backtrace_cleanup_callback
  backtrace_cleaner = Sentry::Rails::BacktraceCleaner.new
  Sentry.configuration.backtrace_cleanup_callback = lambda do |backtrace|
    backtrace_cleaner.clean(backtrace)
  end
end