Sha256: a770aa754cb3e135948ff702df9df55b630299b95f0d093331388f43b802a891
Contents?: true
Size: 1.12 KB
Versions: 23
Compression:
Stored size: 1.12 KB
Contents
require 'rack' module Appsignal module Rack class RailsInstrumentation def initialize(app, options = {}) Appsignal.logger.debug 'Initializing Appsignal::Rack::RailsInstrumentation' @app, @options = app, options end def call(env) if Appsignal.active? call_with_appsignal_monitoring(env) else @app.call(env) end end def call_with_appsignal_monitoring(env) request = ActionDispatch::Request.new(env) transaction = Appsignal::Transaction.create( env['action_dispatch.request_id'], Appsignal::Transaction::HTTP_REQUEST, request ) begin @app.call(env) rescue => error transaction.set_error(error) raise error ensure transaction.set_http_or_background_action transaction.set_http_or_background_queue_start transaction.set_metadata('path', request.path) transaction.set_metadata('method', request.request_method) Appsignal::Transaction.complete_current! end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems