Module: TemplateStreaming::NewRelic::Histogram

Defined in:
lib/template_streaming/new_relic.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



354
355
356
# File 'lib/template_streaming/new_relic.rb', line 354

def self.included(base)
  base.alias_method_chain :process, :template_streaming
end

Instance Method Details

#finish_accumulatingObject



365
366
367
368
# File 'lib/template_streaming/new_relic.rb', line 365

def finish_accumulating
  process_without_template_streaming(agent.accumulated_histogram_time)
  agent.accumulated_histogram_time = nil
end

#process_with_template_streaming(response_time) ⇒ Object



370
371
372
373
374
375
376
# File 'lib/template_streaming/new_relic.rb', line 370

def process_with_template_streaming(response_time)
  if agent.accumulated_histogram_time
    agent.accumulated_histogram_time += response_time
  else
    process_without_template_streaming(response_time)
  end
end

#start_accumulatingObject



358
359
360
361
362
363
# File 'lib/template_streaming/new_relic.rb', line 358

def start_accumulating
  # Agent#reset_stats replaces #histogram with a fresh one, so
  # we can't store accumulating response time in here. Store it
  # in the agent instead.
  agent.accumulated_histogram_time = 0
end