Class: StackifyRubyAPM::Spies::SinatraSpy Private
- Inherits:
-
Object
- Object
- StackifyRubyAPM::Spies::SinatraSpy
- Defined in:
- lib/stackify_apm/spies/sinatra.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #install ⇒ Object private
Instance Method Details
#install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/stackify_apm/spies/sinatra.rb', line 10 def install ::Sinatra::Base.class_eval do alias_method 'dispatch_without_apm!', 'dispatch!' alias_method 'compile_template_without_apm', 'compile_template' # Sets transaction name from Sinatra env's route name # def dispatch!(*args, &block) dispatch_without_apm!(*args, &block).tap do next unless (transaction = StackifyRubyAPM.current_transaction) next unless (route = env['sinatra.route']) transaction.name = route end end # Tilt engine template # def compile_template(engine, data, opts, *args, &block) opts[:__stackify_apm_template_name] = case data when Symbol then data.to_s else format('Inline %s', engine) end compile_template_without_apm(engine, data, opts, *args, &block) end end end |