Class: ScoutApm::SlowPolicy::PercentPolicy

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

Constant Summary collapse

POINT_MULTIPLIER_PERCENT_TIME =

Points for an endpoint’s who’s throughput * response time is a large % of overall time spent processing requests

2.5

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

Of the total time spent handling endpoints in this app, if this endpoint is a higher percent, it should get more points.

A: 20 calls @ 100ms each => 2 seconds of total time B: 10 calls @ 100ms each => 1 second of total time

Then A is 66% of the total call time



16
17
18
19
20
# File 'lib/scout_apm/slow_policy/percent_policy.rb', line 16

def call(request) # Scale 0.0 - 1.0
  percent = context.transaction_time_consumed.percent_of_total(request.unique_name)

  percent * POINT_MULTIPLIER_PERCENT_TIME
end