Module: TingYun::Instrumentation::Support::ControllerInstrumentation

Defined in:
lib/ting_yun/instrumentation/support/controller_instrumentation.rb

Constant Summary collapse

NR_DEFAULT_OPTIONS =
{}.freeze

Instance Method Summary collapse

Instance Method Details

#perform_action_with_tingyun_trace(*args, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ting_yun/instrumentation/support/controller_instrumentation.rb', line 16

def perform_action_with_tingyun_trace (*args, &block)

  state = TingYun::Agent::TransactionState.tl_get

  trace_options = args.last.is_a?(Hash) ? args.last : NR_DEFAULT_OPTIONS
  category = trace_options[:category] || :controller
  txn_options = create_transaction_options(trace_options, category)

  begin
     txn = TingYun::Agent::Transaction.start(state, category, txn_options)
    begin
      yield
    rescue => e
      ::TingYun::Agent.notice_error(e)
      raise
    end
  ensure
    TingYun::Agent::Transaction.stop(state)
  end
end