Class: TingYun::Instrumentation::Rails::ActionViewSubscriber
- Inherits:
-
Support::EventedSubscriber
- Object
- Support::EventedSubscriber
- TingYun::Instrumentation::Rails::ActionViewSubscriber
- Defined in:
- lib/ting_yun/instrumentation/support/action_view_subscriber.rb
Instance Method Summary collapse
-
#finish(name, id, payload) ⇒ Object
THREAD_LOCAL_ACCESS.
- #record_metrics(event, frame) ⇒ Object
-
#start(name, id, payload) ⇒ Object
THREAD_LOCAL_ACCESS.
Methods inherited from Support::EventedSubscriber
#event_stack, #initialize, #log_notification_error, #pop_event, #push_event, subscribe, subscribed?
Constructor Details
This class inherits a constructor from TingYun::Instrumentation::Support::EventedSubscriber
Instance Method Details
#finish(name, id, payload) ⇒ Object
THREAD_LOCAL_ACCESS
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ting_yun/instrumentation/support/action_view_subscriber.rb', line 27 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 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) ⇒ Object
41 42 43 44 45 |
# File 'lib/ting_yun/instrumentation/support/action_view_subscriber.rb', line 41 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) ⇒ Object
THREAD_LOCAL_ACCESS
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |