Class: NewRelic::Rack::AgentHooks

Inherits:
AgentMiddleware show all
Defined in:
lib/new_relic/rack/agent_hooks.rb

Overview

This middleware is used internally by the agent in the rare case where the disable_middleware_instrumentation configuration setting is true. In Rails and Sinatra applications this middleware will be automatically injected if necessary.

If you have disabled middleware instrumentation and are not using Rails or Sinatra you can include this middleware manually in your config.ru file.

All of the functionality of this module resides in the MiddlewareTracing module, which is shared between it and our third party middleware instrumentation.

Constant Summary

Constants included from Agent::Instrumentation::MiddlewareTracing

Agent::Instrumentation::MiddlewareTracing::CONTENT_LENGTH, Agent::Instrumentation::MiddlewareTracing::CONTENT_TYPE, Agent::Instrumentation::MiddlewareTracing::TXN_STARTED_KEY

Instance Attribute Summary

Attributes inherited from AgentMiddleware

#category, #target, #transaction_options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AgentMiddleware

#build_transaction_name, #initialize

Methods included from Agent::Instrumentation::MiddlewareTracing

#_nr_has_middleware_tracing, #build_transaction_options, #call, #capture_http_response_code, #capture_response_attributes, #capture_response_content_length, #capture_response_content_type, #events, #merge_first_middleware_options, #note_transaction_started

Constructor Details

This class inherits a constructor from NewRelic::Rack::AgentMiddleware

Class Method Details

.needed?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/new_relic/rack/agent_hooks.rb', line 25

def self.needed?
  NewRelic::Agent.config[:disable_middleware_instrumentation]
end

Instance Method Details

#traced_call(env) ⇒ Object



29
30
31
# File 'lib/new_relic/rack/agent_hooks.rb', line 29

def traced_call(env)
  @app.call(env)
end