class TingYun::Instrumentation::Rails::ActionViewSubscriber

Public Instance Methods

finish(name, id, payload) click to toggle source
# File lib/ting_yun/instrumentation/support/action_view_subscriber.rb, line 41
def finish(name, id, payload) #THREAD_LOCAL_ACCESS
  event = pop_event(id)

  state = TingYun::Agent::TransactionState.tl_get

  if event.recordable?
    stack = state.traced_method_stack
    stack.pop_frame(state, event.frame, event.metric_name, event.end.to_f)
  end
rescue => e
  log_notification_error(e, name, 'finish')
end
finishV2(name, id, payload) click to toggle source
# File lib/ting_yun/instrumentation/support/action_view_subscriber.rb, line 27
def finishV2(name, id, payload) #THREAD_LOCAL_ACCESS
  event = pop_event(id)

  state = TingYun::Agent::TransactionState.tl_get

  if event.recordable?
    stack = state.traced_method_stack
    frame = stack.pop_frame(state, event.frame, event.metric_name, event.end.to_f)
    record_metrics(event, frame)
  end
rescue => e
  log_notification_error(e, name, 'finish')
end
record_metrics(event, frame) click to toggle source
# File lib/ting_yun/instrumentation/support/action_view_subscriber.rb, line 54
def record_metrics(event, frame)
  exclusive = event.duration - frame.children_time
  TingYun::Agent.instance.stats_engine.tl_record_scoped_and_unscoped_metrics(
      event.metric_name, nil, event.duration, exclusive)
end
start(name, id, payload) click to toggle source
# File lib/ting_yun/instrumentation/support/action_view_subscriber.rb, line 13
def start(name, id, payload) #THREAD_LOCAL_ACCESS
  event = RenderEvent.new(name, Time.now, nil, id, payload)
  push_event(event)

  state = TingYun::Agent::TransactionState.tl_get

  if event.recordable?
    stack = state.traced_method_stack
    event.frame = stack.push_frame(state, :action_view, event.time.to_f)
  end
rescue => e
  log_notification_error(e, name, 'start')
end