Class: ScoutApm::SlowPolicy::SpeedPolicy

Inherits:
Policy
  • Object
show all
Defined in:
lib/scout_apm/slow_policy/speed_policy.rb

Constant Summary collapse

POINT_MULTIPLIER_SPEED =

Adjust speed points. See the function

0.25

Instance Attribute Summary

Attributes inherited from Policy

#context

Instance Method Summary collapse

Methods inherited from Policy

#initialize, #stored!

Constructor Details

This class inherits a constructor from ScoutApm::SlowPolicy::Policy

Instance Method Details

#call(request) ⇒ Object

Time in seconds Logarithm keeps huge times from swamping the other metrics. 1+ is necessary to keep the log function in positive territory.



11
12
13
14
# File 'lib/scout_apm/slow_policy/speed_policy.rb', line 11

def call(request)
  total_time = request.root_layer.total_call_time
  Math.log(1 + total_time) * POINT_MULTIPLIER_SPEED
end