Module: TemplateStreaming::NewRelic::MetricFrame
- Defined in:
- lib/template_streaming/new_relic.rb
Instance Attribute Summary collapse
-
#held_controller_apdex ⇒ Object
readonly
Returns the value of attribute held_controller_apdex.
-
#held_summary_apdex ⇒ Object
readonly
Returns the value of attribute held_summary_apdex.
Class Method Summary collapse
Instance Method Summary collapse
-
#hold_apdex ⇒ Object
Tell the MetricFrame to hold on to the times calculated during #record_apdex instead of adding the apdex value to the stats.
- #record_accumulated_apdex(*previous_frames) ⇒ Object
- #record_apdex_with_template_streaming(*args, &block) ⇒ Object
Instance Attribute Details
#held_controller_apdex ⇒ Object (readonly)
Returns the value of attribute held_controller_apdex.
326 327 328 |
# File 'lib/template_streaming/new_relic.rb', line 326 def held_controller_apdex @held_controller_apdex end |
#held_summary_apdex ⇒ Object (readonly)
Returns the value of attribute held_summary_apdex.
326 327 328 |
# File 'lib/template_streaming/new_relic.rb', line 326 def held_summary_apdex @held_summary_apdex end |
Class Method Details
.included(base) ⇒ Object
300 301 302 |
# File 'lib/template_streaming/new_relic.rb', line 300 def self.included(base) base.alias_method_chain :record_apdex, :template_streaming end |
Instance Method Details
#hold_apdex ⇒ Object
Tell the MetricFrame to hold on to the times calculated during #record_apdex instead of adding the apdex value to the stats.
Call #record_accumulated_apdex on another MetricFrame with this frame as an argument to record the total time.
311 312 313 |
# File 'lib/template_streaming/new_relic.rb', line 311 def hold_apdex @hold_apdex = true end |
#record_accumulated_apdex(*previous_frames) ⇒ Object
328 329 330 331 332 333 334 335 336 337 |
# File 'lib/template_streaming/new_relic.rb', line 328 def record_accumulated_apdex(*previous_frames) return unless recording_web_transaction? && ::NewRelic::Agent.is_execution_traced? ending = Time.now.to_f total_summary_apdex = previous_frames.map{|frame| frame.held_summary_apdex}.sum total_controller_apdex = previous_frames.map{|frame| frame.held_controller_apdex}.sum summary_stat = ::NewRelic::Agent.instance.stats_engine.get_custom_stats("Apdex", ::NewRelic::ApdexStats) controller_stat = ::NewRelic::Agent.instance.stats_engine.get_custom_stats("Apdex/#{path}", ::NewRelic::ApdexStats) self.class.update_apdex(summary_stat, total_summary_apdex + ending - apdex_start, exception) self.class.update_apdex(controller_stat, total_controller_apdex + ending - start, exception) end |
#record_apdex_with_template_streaming(*args, &block) ⇒ Object
315 316 317 318 319 320 321 322 323 324 |
# File 'lib/template_streaming/new_relic.rb', line 315 def record_apdex_with_template_streaming(*args, &block) return unless recording_web_transaction? && ::NewRelic::Agent.is_execution_traced? ending = Time.now.to_f if @hold_apdex @held_summary_apdex = ending - apdex_start @held_controller_apdex = ending - start return end record_apdex_without_template_streaming(*args, &block) end |