Module: NewRelic::Agent::Instrumentation::Sinatra::Chain

Defined in:
lib/new_relic/agent/instrumentation/sinatra/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



8
9
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
# File 'lib/new_relic/agent/instrumentation/sinatra/chain.rb', line 8

def self.instrument!
  ::Sinatra::Base.class_eval do
    include ::NewRelic::Agent::Instrumentation::Sinatra::Tracer

    def dispatch_with_newrelic
      dispatch_with_tracing { dispatch_without_newrelic }
    end
    alias dispatch_without_newrelic dispatch!
    alias dispatch! dispatch_with_newrelic

    def process_route_with_newrelic(*args, &block)
      process_route_with_tracing(*args) do
        process_route_without_newrelic(*args, &block)
      end
    end
    alias process_route_without_newrelic process_route
    alias process_route process_route_with_newrelic

    def route_eval_with_newrelic(*args, &block)
      route_eval_with_tracing(*args) do
        route_eval_without_newrelic(*args, &block)
      end
    end
    alias route_eval_without_newrelic route_eval
    alias route_eval route_eval_with_newrelic
  end
end