Sha256: 568f442210cb59ed66f291e66fd5e00b499845b299c8f21e1d05453aa7bd0f42
Contents?: true
Size: 1.18 KB
Versions: 8
Compression:
Stored size: 1.18 KB
Contents
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details. require 'new_relic/agent/event_listener' require 'new_relic/rack/agent_middleware' require 'new_relic/agent/instrumentation/middleware_proxy' module NewRelic::Rack # This middleware is used by the agent internally, and is usually injected # automatically into the middleware chain. If automatic injection is not # working, you may manually use it in your middleware chain instead. # # @api public # class AgentHooks < AgentMiddleware FIRED_FORMATS = { :before_call => "newrelic.agent_hooks_before_fired", :after_call => "newrelic.agent_hooks_after_fired" } # method required by Rack interface # [status, headers, response] def traced_call(env) notify(:before_call, env) result = @app.call(env) notify(:after_call, env, result) result end def notify(event, env, *args) key = FIRED_FORMATS[event] events.notify(event, *([env] + args)) unless env[key] env[key] = true end def events NewRelic::Agent.instance.events end end end
Version data entries
8 entries across 8 versions & 1 rubygems