Module: NewRelic::Agent::Instrumentation::Padrino

Included in:
NewRelic::Agent::Instrumentation::PadrinoTracer::Prepend
Defined in:
lib/new_relic/agent/instrumentation/padrino/instrumentation.rb

Constant Summary collapse

INSTRUMENTATION_NAME =
NewRelic::Agent.base_name(name)

Instance Method Summary collapse

Instance Method Details

#invoke_route_with_tracing(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/new_relic/agent/instrumentation/padrino/instrumentation.rb', line 9

def invoke_route_with_tracing(*args)
  NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)

  begin
    env['newrelic.last_route'] = args[0].original_path
  rescue => e
    ::NewRelic::Agent.logger.debug('Failed determining last route in Padrino', e)
  end

  begin
    txn_name = ::NewRelic::Agent::Instrumentation::Sinatra::TransactionNamer.transaction_name_for_route(env, request)
    unless txn_name.nil?
      ::NewRelic::Agent::Transaction.set_default_transaction_name(
        "#{self.class.name}/#{txn_name}", :sinatra
      )
    end
  rescue => e
    ::NewRelic::Agent.logger.debug('Failed during invoke_route to set transaction name', e)
  end

  yield
end