Module: NewRelic::Agent::Instrumentation::Sinatra::ClassMethods
- Defined in:
- lib/new_relic/agent/instrumentation/sinatra.rb
Instance Method Summary collapse
- #build_with_newrelic(*args, &block) ⇒ Object
- #newrelic_middlewares ⇒ Object
- #try_to_use(app, clazz) ⇒ Object
Instance Method Details
#build_with_newrelic(*args, &block) ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/new_relic/agent/instrumentation/sinatra.rb', line 93 def build_with_newrelic(*args, &block) unless NewRelic::Agent.config[:disable_sinatra_auto_middleware] newrelic_middlewares.each do |middleware_class| try_to_use(self, middleware_class) end end build_without_newrelic(*args, &block) end |
#newrelic_middlewares ⇒ Object
87 88 89 90 91 |
# File 'lib/new_relic/agent/instrumentation/sinatra.rb', line 87 def newrelic_middlewares [ NewRelic::Rack::AgentHooks, NewRelic::Rack::BrowserMonitoring, NewRelic::Rack::ErrorCollector ] end |
#try_to_use(app, clazz) ⇒ Object
102 103 104 105 |
# File 'lib/new_relic/agent/instrumentation/sinatra.rb', line 102 def try_to_use(app, clazz) has_middleware = app.middleware.any? { |info| info[0] == clazz } app.use(clazz) unless has_middleware end |