Sha256: e224e41fb6a54972a8ffe9d0396feaa5144a4eab20060facdf8fc7bbd9b15446
Contents?: true
Size: 1.21 KB
Versions: 10
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require 'airbrake/rails/event' module Airbrake module Rails # @since v8.3.0 class ActionControllerPerformanceBreakdownSubscriber def call(*args) return unless Airbrake::Config.instance.performance_stats routes = Airbrake::Rack::RequestStore[:routes] return if !routes || routes.none? event = Airbrake::Rails::Event.new(*args) stash = build_stash routes.each do |route, params| groups = event.groups.merge(params[:groups]) next if groups.none? breakdown_info = { method: event.method, route: route, response_type: event.response_type, groups: groups, timing: event.duration, time: event.time, } Airbrake.notify_performance_breakdown(breakdown_info, stash) end end private def build_stash stash = {} request = Airbrake::Rack::RequestStore[:request] return stash unless request stash[:request] = request if (user = Airbrake::Rack::User.extract(request.env)) stash.merge!(user.as_json) end stash end end end end
Version data entries
10 entries across 10 versions & 1 rubygems