Class: TingYun::Instrumentation::Rails::ActionCableSubscriber

Inherits:
Support::EventedSubscriber show all
Defined in:
lib/ting_yun/instrumentation/support/action_cable_subscriber.rb

Constant Summary collapse

PERFORM_ACTION =
'perform_action.action_cable'.freeze

Instance Method Summary collapse

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_cable_subscriber.rb', line 27

def finish (name, id, payload) #THREAD_LOCAL_ACCESS
  state = TingYun::Agent::TransactionState.tl_get
  return unless state.execution_traced?
  event = super
  notice_error payload if payload.key? :exception
  if event.name == PERFORM_ACTION
    finish_transaction state
  else
    stop_recording_metrics state, event
  end
rescue => e
  log_notification_error e, name, 'finish'
end

#start(name, id, payload) ⇒ Object

THREAD_LOCAL_ACCESS



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ting_yun/instrumentation/support/action_cable_subscriber.rb', line 14

def start (name, id, payload) #THREAD_LOCAL_ACCESS
  state = TingYun::Agent::TransactionState.tl_get
  return unless state.execution_traced?
  event = super
  if event.name == PERFORM_ACTION
    start_transaction state, event
  else
    start_recording_metrics state, event
  end
rescue => e
  log_notification_error e, name, 'start'
end