-
Notifications
You must be signed in to change notification settings - Fork 141
Sinatra Spy does not set endpoint name if Error inside endpoint #1561
Copy link
Copy link
Open
Labels
Description
Describe the bug
Transaction name is "Rack" (because of Rack Middleware) if an error happens inside the endpoint.
Steps to reproduce
Create Sinatra application, throw an error inside the endpoint like:
def hello
raise MyError
end
Expected behavior
Sinatra Spy should update transaction name even if Error occurs
Current code:
class SinatraSpy
# @api private
module Ext
def dispatch!(*args, &block)
super(*args, &block).tap do # <------- Error occurs inside here! (sometimes)
next unless (transaction = ElasticAPM.current_transaction)
next unless (route = env['sinatra.route'])
transaction.name = route # <----------- this should get called regardless!
end
end
My suggestion:
class SinatraSpy
# @api private
module Ext
def dispatch!(*args, &block)
begin
super(*args, &block)
ensure
if (transaction = ElasticAPM.current_transaction) && (route = env['sinatra.route'])
transaction.name = route
end
end
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.