class ScoutApm::SlowPolicy::AgePolicy
Constants
- POINT_MULTIPLIER_AGE
-
For each minute we haven’t seen an endpoint
Attributes
A hash of Endpoint Name to the last time we stored a slow transaction for it.
Defaults to a start time that is pretty close to application boot time. So the “age” of an endpoint we’ve never seen is the time the application has been running.
Public Class Methods
Source
# File lib/scout_apm/slow_policy/age_policy.rb, line 15 def initialize(context) super zero_time = Time.now @last_seen = Hash.new { |h, k| h[k] = zero_time } end
Calls superclass method
Public Instance Methods
Source
# File lib/scout_apm/slow_policy/age_policy.rb, line 22 def call(request) # How long has it been since we've seen this? age = Time.now - last_seen[request.unique_name] age / 60.0 * POINT_MULTIPLIER_AGE end
Source
# File lib/scout_apm/slow_policy/age_policy.rb, line 29 def stored!(request) last_seen[request.unique_name] = Time.now end