class ScoutApm::RequestHistograms
Constants
- DEFAULT_HISTOGRAM_SIZE
Attributes
Private Accessor: A hash of Endpoint Name to an approximate histogram
Each time a new request is requested to see if it’s slow or not, we should insert it into the histogram, and get the approximate percentile of that time
Public Class Methods
Source
# File lib/scout_apm/request_histograms.rb, line 16 def initialize(histogram_size = DEFAULT_HISTOGRAM_SIZE) @histogram_size = histogram_size initialize_histograms_hash end
Public Instance Methods
Source
# File lib/scout_apm/request_histograms.rb, line 33 def add(item, value) @histograms[item].add(value) end
Source
# File lib/scout_apm/request_histograms.rb, line 37 def approximate_quantile_of_value(item, value) @histograms[item].approximate_quantile_of_value(value) end
Source
# File lib/scout_apm/request_histograms.rb, line 25 def as_json Hash[ @histograms.map{ |key, histogram| [key, histogram.as_json] } ] end
Source
# File lib/scout_apm/request_histograms.rb, line 21 def each_name @histograms.keys.each { |n| yield n } end
Source
# File lib/scout_apm/request_histograms.rb, line 54 def initialize_histograms_hash @histograms = Hash.new { |h, k| h[k] = NumericHistogram.new(histogram_size) } end
Source
# File lib/scout_apm/request_histograms.rb, line 41 def quantile(item, q) @histograms[item].quantile(q) end
Source
# File lib/scout_apm/request_histograms.rb, line 50 def raw(item) @histograms[item] end
Source
# File lib/scout_apm/request_histograms.rb, line 46 def reset_all! initialize_histograms_hash end
Wipes all histograms, setting them back to empty