Class: ScoutApm::Instruments::PercentileSampler
- Inherits:
-
Object
- Object
- ScoutApm::Instruments::PercentileSampler
- Defined in:
- lib/scout_apm/instruments/percentile_sampler.rb
Instance Method Summary collapse
- #histograms ⇒ Object
- #human_name ⇒ Object
-
#initialize(context) ⇒ PercentileSampler
constructor
A new instance of PercentileSampler.
- #logger ⇒ Object
- #metrics(timestamp, store) ⇒ Object
- #percentiles(time) ⇒ Object
Constructor Details
#initialize(context) ⇒ PercentileSampler
Returns a new instance of PercentileSampler.
21 22 23 |
# File 'lib/scout_apm/instruments/percentile_sampler.rb', line 21 def initialize(context) @context = context end |
Instance Method Details
#histograms ⇒ Object
25 26 27 |
# File 'lib/scout_apm/instruments/percentile_sampler.rb', line 25 def histograms @context.request_histograms_by_time end |
#human_name ⇒ Object
33 34 35 |
# File 'lib/scout_apm/instruments/percentile_sampler.rb', line 33 def human_name 'Percentiles' end |
#logger ⇒ Object
29 30 31 |
# File 'lib/scout_apm/instruments/percentile_sampler.rb', line 29 def logger @context.logger end |
#metrics(timestamp, store) ⇒ Object
37 38 39 |
# File 'lib/scout_apm/instruments/percentile_sampler.rb', line 37 def metrics(, store) store.track_histograms!(percentiles(), :timestamp => ) end |
#percentiles(time) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/scout_apm/instruments/percentile_sampler.rb', line 41 def percentiles(time) result = [] histogram = histograms.delete(time) return result unless histogram histogram.each_name do |name| result << HistogramReport.new(name, histogram.raw(name)) end result end |