Sha256: c8a027ec1064c7385886c062982e6ba0151020de3a4e8c748754855bcbae7d78
Contents?: true
Size: 1.32 KB
Versions: 15
Compression:
Stored size: 1.32 KB
Contents
require "rack" module Appsignal # @api private module Rack class GenericInstrumentation def initialize(app, options = {}) Appsignal.logger.debug "Initializing Appsignal::Rack::GenericInstrumentation" @app = app @options = 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 = ::Rack::Request.new(env) transaction = Appsignal::Transaction.create( SecureRandom.uuid, Appsignal::Transaction::HTTP_REQUEST, request ) begin Appsignal.instrument("process_action.generic") do @app.call(env) end rescue => error transaction.set_error(error) raise error ensure if env["appsignal.route"] transaction.set_action_if_nil(env["appsignal.route"]) else transaction.set_action_if_nil("unknown") end transaction.set_metadata("path", request.path) transaction.set_metadata("method", request.request_method) transaction.set_http_or_background_queue_start Appsignal::Transaction.complete_current! end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems