Class: NewRelic::MethodTraceStats
- Defined in:
- lib/new_relic/stats.rb
Overview
Statistics used to track the performance of traced methods
Direct Known Subclasses
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
- #increment_count(value = 1) ⇒ Object
-
#record_data_point(value, exclusive_time = value) ⇒ Object
(also: #trace_call)
record a single data point into the statistical gatherer.
- #record_multiple_data_points(total_value, count = 1) ⇒ Object
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, #duration, #exclusive_time_percentage, #fraction_of, #get_apdex, #is_reset?, #merge, #merge!, #multiply_by, #reset, #round!, #split, #standard_deviation, #sum_merge!, #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
344 345 346 |
# File 'lib/new_relic/stats.rb', line 344 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
319 320 321 322 323 324 325 326 327 328 |
# File 'lib/new_relic/stats.rb', line 319 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
332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/new_relic/stats.rb', line 332 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 |