Method: TingYun::Instrumentation::Support::ControllerInstrumentation#perform_action_with_tingyun_trace

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

#perform_action_with_tingyun_trace(*args, &block) ⇒ Object



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/ting_yun/instrumentation/support/controller_instrumentation.rb', line 212

def perform_action_with_tingyun_trace (*args, &block)

  state = TingYun::Agent::TransactionState.tl_get

  skip_tracing = !state.execution_traced?

  if skip_tracing
    state.current_transaction.ignore! if state.current_transaction
    TingYun::Agent.disable_all_tracing { return yield }
  end
  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
    TingYun::Agent::Transaction.start(state, category, txn_options)
    begin
      yield
    rescue => e
      ::TingYun::Agent.notice_error(e,:type=> :exception)
      raise e
    end
  ensure
    TingYun::Agent::Transaction.stop(state)
  end
end