Class: Fare::Middleware::NewRelic

Inherits:
Object
  • Object
show all
Includes:
NewRelic::Agent::Instrumentation::ControllerInstrumentation
Defined in:
lib/fare/middleware/newrelic.rb

Overview

Add NewRelic monitoring to the subscriber. Make sure you have a newrelic.yml in your config dir.

Usage:

subscriber do
  setup do
    require "fare/middleware/newrelic"
  end
  always_run do
    use Fare::Middleware::NewRelic
  end
end

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ NewRelic

Returns a new instance of NewRelic.



23
24
25
26
# File 'lib/fare/middleware/newrelic.rb', line 23

def initialize(app, options = {})
  @app = app
  at_exit { ::NewRelic::Agent.shutdown }
end

Instance Method Details

#call(env) ⇒ Object



28
29
30
# File 'lib/fare/middleware/newrelic.rb', line 28

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