Class: NewRelic::Agent::Instrumentation::Praxis::ActionSubscriber
- Inherits:
-
EventedSubscriber
- Object
- EventedSubscriber
- NewRelic::Agent::Instrumentation::Praxis::ActionSubscriber
- Defined in:
- lib/newrelic-praxis/praxis/action_subscriber.rb
Instance Method Summary collapse
-
#finish(name, id, payload) ⇒ Object
THREAD_LOCAL_ACCESS.
-
#start(name, id, payload) ⇒ Object
THREAD_LOCAL_ACCESS.
- #start_transaction(state, event) ⇒ Object
- #stop_transaction(state, event = nil) ⇒ Object
Instance Method Details
#finish(name, id, payload) ⇒ Object
THREAD_LOCAL_ACCESS
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/newrelic-praxis/praxis/action_subscriber.rb', line 29 def finish(name, id, payload) #THREAD_LOCAL_ACCESS event = pop_event(id) event.payload.merge!(payload) state = TransactionState.tl_get request = event.request attributes = {:'request.parameters' => request.params_hash} attributes.merge!( :'request.api_version' => request.version ) NewRelic::Agent.add_custom_attributes(attributes) if state.is_execution_traced? && !event.ignored? stop_transaction(state, event) else NewRelic::Agent.instance.pop_trace_execution_flag end rescue => e log_notification_error(e, name, 'finish') end |
#start(name, id, payload) ⇒ Object
THREAD_LOCAL_ACCESS
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/newrelic-praxis/praxis/action_subscriber.rb', line 8 def start(name, id, payload) #THREAD_LOCAL_ACCESS state = TransactionState.tl_get controller = payload[:controller] request = controller.request event = ActionEvent.new(name, Time.now, nil, id, payload, request) push_event(event) if state.is_execution_traced? && !event.ignored? start_transaction(state, event) else # if this transaction is ignored, make sure child # transaction are also ignored state.current_transaction.ignore! if state.current_transaction NewRelic::Agent.instance.push_trace_execution_flag(false) end rescue => e log_notification_error(e, name, 'start') end |
#start_transaction(state, event) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/newrelic-praxis/praxis/action_subscriber.rb', line 52 def start_transaction(state, event) Transaction.start(state, :controller, :transaction_name => event.metric_name, :apdex_start_time => event.queue_start ) end |
#stop_transaction(state, event = nil) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/newrelic-praxis/praxis/action_subscriber.rb', line 59 def stop_transaction(state, event=nil) txn = state.current_transaction txn.ignore_apdex! if event.apdex_ignored? txn.ignore_enduser! if event.enduser_ignored? Transaction.stop(state) end |