Module: NewRelic::Agent::Instrumentation::Sinatra::NewRelic
- Extended by:
- NewRelic
- Included in:
- NewRelic
- Defined in:
- lib/new_relic/agent/instrumentation/sinatra.rb
Instance Method Summary collapse
Instance Method Details
#http_verb(request) ⇒ Object
68 69 70 |
# File 'lib/new_relic/agent/instrumentation/sinatra.rb', line 68 def http_verb(request) request.request_method if request.respond_to?(:request_method) end |
#transaction_name(routes, request) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/new_relic/agent/instrumentation/sinatra.rb', line 72 def transaction_name(routes, request) name = '(unknown)' verb = http_verb(request) Array(routes[verb]).each do |pattern, keys, conditions, block| if route = yield(pattern, keys, conditions) name = route # it's important we short circuit here. Otherwise we risk # applying conditions from lower priority routes which can # break the action. break end end name.gsub!(%r{^[/^]*(.*?)[/\$\?]*$}, '\1') if verb name = verb + ' ' + name end name end |