Class: NewRelic::Agent::Instrumentation::Grape
- Inherits:
-
Grape::Middleware::Base
- Object
- Grape::Middleware::Base
- NewRelic::Agent::Instrumentation::Grape
- Includes:
- ControllerInstrumentation
- Defined in:
- lib/newrelic-grape/instrument.rb
Instance Method Summary collapse
Instance Method Details
#call!(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/newrelic-grape/instrument.rb', line 11 def call!(env) @env = env @newrelic_request = ::Rack::Request.new(env) = { :category => :rack, :path => "#{request_method} #{request_path}", :request => @newrelic_request, :params => @newrelic_request.params } perform_action_with_newrelic_trace() do @app_response = @app.call(@env) end end |
#request_method ⇒ Object
37 38 39 |
# File 'lib/newrelic-grape/instrument.rb', line 37 def request_method @newrelic_request.request_method end |
#request_path ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/newrelic-grape/instrument.rb', line 29 def request_path path = route.route_path[1..-1].gsub('/', '-') path.sub!(/\(\.:format\)\z/, '') route.route_version && path.sub!(':version', route.route_version) path end |
#route ⇒ Object
25 26 27 |
# File 'lib/newrelic-grape/instrument.rb', line 25 def route env['api.endpoint'].routes.first end |