Sha256: f6d168f2eca23437c6a4b648918fb221f1af4fdc1dceee180976edf5414b48b2
Contents?: true
Size: 1.08 KB
Versions: 7
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require 'airbrake/rails/event' require 'airbrake/rails/backtrace_cleaner' module Airbrake module Rails # ActiveRecordSubscriber sends SQL information, including performance data. # # @since v8.1.0 class ActiveRecordSubscriber def call(*args) routes = Airbrake::Rack::RequestStore[:routes] return if !routes || routes.none? event = Airbrake::Rails::Event.new(*args) frame = last_caller routes.each do |route, params| Airbrake.notify_query( route: route, method: params[:method], query: event.sql, func: frame[:function], file: frame[:file], line: frame[:line], timing: event.duration, time: event.time, ) end end private def last_caller exception = StandardError.new exception.set_backtrace( Airbrake::Rails::BacktraceCleaner.clean(Kernel.caller), ) Airbrake::Backtrace.parse(exception).first || {} end end end end
Version data entries
7 entries across 7 versions & 1 rubygems