Class: ScoutApm::SlowPolicy::PercentilePolicy
- Defined in:
- lib/scout_apm/slow_policy/percentile_policy.rb
Instance Attribute Summary
Attributes inherited from Policy
Instance Method Summary collapse
Methods inherited from Policy
Constructor Details
This class inherits a constructor from ScoutApm::SlowPolicy::Policy
Instance Method Details
#call(request) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/scout_apm/slow_policy/percentile_policy.rb', line 5 def call(request) # What approximate percentile was this request? total_time = request.root_layer.total_call_time percentile = context.request_histograms.approximate_quantile_of_value(request.unique_name, total_time) if percentile < 40 0.4 # Don't put much emphasis on capturing low percentiles. elsif percentile < 60 1.4 # Highest here to get mean traces elsif percentile < 90 0.7 # Between 60 & 90% is fine. elsif percentile >= 90 1.4 # Highest here to get 90+%ile traces else # impossible. percentile end end |