module NewRelic::Agent::Instrumentation::Sinatra::ClassMethods
Public Instance Methods
build_with_newrelic(*args, &block)
click to toggle source
# File lib/new_relic/agent/instrumentation/sinatra.rb, line 95 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()
click to toggle source
# File lib/new_relic/agent/instrumentation/sinatra.rb, line 87 def newrelic_middlewares middlewares = [NewRelic::Rack::BrowserMonitoring] if NewRelic::Rack::AgentHooks.needed? middlewares << NewRelic::Rack::AgentHooks end middlewares end
try_to_use(app, clazz)
click to toggle source
# File lib/new_relic/agent/instrumentation/sinatra.rb, line 104 def try_to_use(app, clazz) has_middleware = app.middleware.any? { |info| info[0] == clazz } app.use(clazz) unless has_middleware end