Module: TemplateStreaming::NewRelic::Controller
- Defined in:
- lib/template_streaming/new_relic.rb
Class Method Summary collapse
Instance Method Summary collapse
- #perform_action_with_template_streaming(*args, &block) ⇒ Object
- #process_with_template_streaming(request, response, method = :perform_action, *arguments) ⇒ Object
Class Method Details
.included(base) ⇒ Object
149 150 151 152 153 154 155 156 157 158 |
# File 'lib/template_streaming/new_relic.rb', line 149 def self.included(base) base.class_eval do # Make sure New Relic's hook wraps ours so we have access to the metric frame it sets. method_name = :perform_action_with_newrelic_trace method_defined?(method_name) || private_method_defined?(method_name) and raise "Template Streaming must be loaded before New Relic's controller instrumentation" alias_method_chain :process, :template_streaming alias_method_chain :perform_action, :template_streaming end end |
Instance Method Details
#perform_action_with_template_streaming(*args, &block) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/template_streaming/new_relic.rb', line 166 def perform_action_with_template_streaming(*args, &block) unless _is_filtered?('do_not_trace') frame_data = request.env[ENV_FRAME_DATA] = ::NewRelic::Agent::Instrumentation::MetricFrame.current frame_data.hold_apdex # This depends on current scope stack, so stash it too. request.env[ENV_RECORDED_METRICS] = ::NewRelic::Agent::Instrumentation::MetricFrame.current.recorded_metrics request.env[ENV_METRIC_PATH] = newrelic_metric_path request.env[ENV_IGNORE_APDEX] = _is_filtered?('ignore_apdex') end perform_action_without_template_streaming(*args, &block) end |
#process_with_template_streaming(request, response, method = :perform_action, *arguments) ⇒ Object
160 161 162 163 164 |
# File 'lib/template_streaming/new_relic.rb', line 160 def process_with_template_streaming(request, response, method = :perform_action, *arguments) metric_names = ["HttpDispatcher", "Controller/#{newrelic_metric_path(request.parameters['action'])}"] ::NewRelic::Agent.instance.start_accumulating(*metric_names) process_without_template_streaming(request, response, method, *arguments) end |