Class: NewRelic::MethodTraceStats

Inherits:
StatsBase show all
Defined in:
lib/new_relic/stats.rb

Overview

Statistics used to track the performance of traced methods

Direct Known Subclasses

ScopedMethodTraceStats

Instance Attribute Summary

Attributes inherited from StatsBase

#call_count, #max_call_time, #min_call_time, #sum_of_squares, #total_call_time, #total_exclusive_time

Instance Method Summary collapse

Methods inherited from StatsBase

#begin_time, #begin_time=, #end_time, #end_time=, #freeze, #initialize, #to_json

Methods included from Stats

#absent?, #apdex_score, #as_percentage, #as_percentage_of, #average_call_time, #average_exclusive_time, #calls_per_minute, #calls_per_second, #duration, #exclusive_time_percentage, #fraction_of, #get_apdex, #is_reset?, #merge, #merge!, #multiply_by, #reset, #round!, #split, #standard_deviation, #summary, #time_percentage, #time_str, #to_s, #total_call_time_per_minute

Constructor Details

This class inherits a constructor from NewRelic::StatsBase

Instance Method Details

#increment_count(value = 1) ⇒ Object



338
339
340
# File 'lib/new_relic/stats.rb', line 338

def increment_count(value = 1)
  @call_count += value
end

#record_data_point(value, exclusive_time = value) ⇒ Object Also known as: trace_call

record a single data point into the statistical gatherer. The gatherer will aggregate all data points collected over a specified period and upload its data to the NewRelic server



313
314
315
316
317
318
319
320
321
322
# File 'lib/new_relic/stats.rb', line 313

def record_data_point(value, exclusive_time = value)
  @call_count += 1
  @total_call_time += value
  @min_call_time = value if value < @min_call_time || @call_count == 1
  @max_call_time = value if value > @max_call_time
  @total_exclusive_time += exclusive_time

  @sum_of_squares += (value * value)
  self
end

#record_multiple_data_points(total_value, count = 1) ⇒ Object



326
327
328
329
330
331
332
333
334
335
336
# File 'lib/new_relic/stats.rb', line 326

def record_multiple_data_points(total_value, count=1)
  return record_data_point(total_value) if count == 1
  @call_count += count
  @total_call_time += total_value
  avg_val = total_value / count
  @min_call_time = avg_val if avg_val < @min_call_time || @call_count == count
  @max_call_time = avg_val if avg_val > @max_call_time
  @total_exclusive_time += total_value
  @sum_of_squares += (avg_val * avg_val) * count
  self
end