Class: OneApm::Agent::Instrumentation::ActionControllerSubscriber
Instance Method Summary
collapse
#event_stack, #initialize, #log_notification_error, #pop_event, #push_event, subscribe, subscribed?
Instance Method Details
#filter(params) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/one_apm/inst/rails4/action_controller_subscriber.rb', line 58
def filter(params)
munged_params = params.dup
munged_params.delete('controller')
munged_params.delete('action')
filters = Rails.application.config.filter_parameters
ActionDispatch::Http::ParameterFilter.new(filters).filter(munged_params)
end
|
#finish(name, id, payload) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/one_apm/inst/rails4/action_controller_subscriber.rb', line 28
def finish(name, id, payload)
event = pop_event(id)
event.payload.merge!(payload)
state = TransactionState.tl_get
if state.is_execution_traced? && !event.ignored?
stop_transaction(state, event)
else
OneApm::Manager.agent.pop_trace_execution_flag
end
rescue => e
log_notification_error(e, name, 'finish')
end
|
#start(name, id, payload) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/one_apm/inst/rails4/action_controller_subscriber.rb', line 10
def start(name, id, payload)
state = TransactionState.tl_get
request = state.request
event = ControllerEvent.new(name, Time.now, nil, id, payload, request)
push_event(event)
if state.is_execution_traced? && !event.ignored?
start_transaction(state, event)
else
state.current_transaction.ignore! if state.current_transaction
OneApm::Manager.agent.push_trace_execution_flag(false)
end
rescue => e
log_notification_error(e, name, 'start')
end
|
#start_transaction(state, event) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/one_apm/inst/rails4/action_controller_subscriber.rb', line 43
def start_transaction(state, event)
Transaction.start(state, :controller,
:request => event.request,
:filtered_params => filter(event.payload[:params]),
:apdex_start_time => event.queue_start,
:transaction_name => event.metric_name)
end
|
#stop_transaction(state, event) ⇒ Object
51
52
53
54
55
56
|
# File 'lib/one_apm/inst/rails4/action_controller_subscriber.rb', line 51
def stop_transaction(state, event)
txn = state.current_transaction
txn.ignore_apdex! if event.apdex_ignored?
txn.ignore_enduser! if event.enduser_ignored?
Transaction.stop(state)
end
|