class ScoutApm::TransactionTimeConsumed
Constants
- TotalTimeRecord
Time is in seconds
Attributes
endpoints[R]
Private Accessor: A hash of Endpoint Name to an time consumed record
total_duration[R]
Private Accessor: The total time spent across all endpoints
Public Class Methods
new()
click to toggle source
# File lib/scout_apm/transaction_time_consumed.rb, line 13 def initialize @total_duration = 0.0 @endpoints = Hash.new { |h, k| h[k] = TotalTimeRecord.new } end
Public Instance Methods
add(item, duration)
click to toggle source
# File lib/scout_apm/transaction_time_consumed.rb, line 18 def add(item, duration) @total_duration += duration.to_f @endpoints[item].add(duration.to_f) end
call_count_for(item)
click to toggle source
# File lib/scout_apm/transaction_time_consumed.rb, line 35 def call_count_for(item) @endpoints[item].count end
percent_of_total(item)
click to toggle source
# File lib/scout_apm/transaction_time_consumed.rb, line 23 def percent_of_total(item) if total_duration == 0.0 0 else @endpoints[item].total_duration / total_duration end end
total_time_for(item)
click to toggle source
# File lib/scout_apm/transaction_time_consumed.rb, line 31 def total_time_for(item) @endpoints[item].total_duration end