Class: NewRelic::Agent::Instrumentation::ControllerEvent
- Inherits:
-
Event
- Object
- Event
- NewRelic::Agent::Instrumentation::ControllerEvent
show all
- Defined in:
- lib/new_relic/agent/instrumentation/action_controller_subscriber.rb
Instance Attribute Summary collapse
Attributes inherited from Event
#children, #end, #name, #payload, #time, #transaction_id
Instance Method Summary
collapse
Methods inherited from Event
#<<, #duration, #parent_of?
Constructor Details
#initialize(name, start, ending, transaction_id, payload) ⇒ ControllerEvent
Returns a new instance of ControllerEvent.
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 125
def initialize(name, start, ending, transaction_id, payload)
super
@controller_class = payload[:controller].split('::') \
.inject(Object){|m,o| m.const_get(o)}
if payload[:request] && payload[:request].respond_to?(:env)
@queue_start = QueueTime.parse_frontend_timestamp(payload[:request].env, self.time)
end
end
|
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
122
123
124
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 122
def parent
@parent
end
|
#queue_start ⇒ Object
Returns the value of attribute queue_start.
123
124
125
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 123
def queue_start
@queue_start
end
|
#scope ⇒ Object
Returns the value of attribute scope.
122
123
124
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 122
def scope
@scope
end
|
Instance Method Details
#_is_filtered?(key) ⇒ Boolean
FIXME: shamelessly ripped from ControllerInstrumentation
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 177
def _is_filtered?(key)
if @controller_class.respond_to? :newrelic_read_attr
ignore_actions = @controller_class.newrelic_read_attr(key)
end
case ignore_actions
when nil; false
when Hash
only_actions = Array(ignore_actions[:only])
except_actions = Array(ignore_actions[:except])
only_actions.include?(metric_action.to_sym) || (except_actions.any? && !except_actions.include?(metric_action.to_sym))
else
true
end
end
|
#apdex_ignored? ⇒ Boolean
164
165
166
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 164
def apdex_ignored?
_is_filtered?('ignore_apdex')
end
|
#enduser_ignored? ⇒ Boolean
168
169
170
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 168
def enduser_ignored?
_is_filtered?('ignore_enduser')
end
|
#exception_encountered? ⇒ Boolean
172
173
174
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 172
def exception_encountered?
payload[:exception]
end
|
#finalize_metric_name! ⇒ Object
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 140
def finalize_metric_name!
txn = NewRelic::Agent::Transaction.current
txn.name ||= metric_name
txn.freeze_name
@metric_name = txn.name
return @metric_name
end
|
#ignored? ⇒ Boolean
160
161
162
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 160
def ignored?
_is_filtered?('do_not_trace')
end
|
#metric_action ⇒ Object
156
157
158
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 156
def metric_action
payload[:action]
end
|
#metric_name ⇒ Object
136
137
138
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 136
def metric_name
@metric_name || "Controller/#{metric_path}/#{metric_action}"
end
|
#metric_path ⇒ Object
152
153
154
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 152
def metric_path
@controller_class.controller_path
end
|
#to_s ⇒ Object
193
194
195
|
# File 'lib/new_relic/agent/instrumentation/action_controller_subscriber.rb', line 193
def to_s
"#<NewRelic::Agent::Instrumentation::ControllerEvent:#{object_id} name: \"#{name}\" id: #{transaction_id} payload: #{payload}}>"
end
|