Class: NewRelic::Histogram
- Inherits:
-
Object
- Object
- NewRelic::Histogram
- Defined in:
- lib/new_relic/histogram.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#buckets ⇒ Object
readonly
Returns the value of attribute buckets.
Instance Method Summary collapse
-
#initialize(first_bucket_max = 0.010, bucket_count = 30, multiplier = 1.3) ⇒ Histogram
constructor
Histogram uses apdex T / 10 as its minimum bucket size, and grows from there.
- #process(response_time) ⇒ Object
Constructor Details
#initialize(first_bucket_max = 0.010, bucket_count = 30, multiplier = 1.3) ⇒ Histogram
Histogram uses apdex T / 10 as its minimum bucket size, and grows from there. 30 data points should be adequate resolution.
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/new_relic/histogram.rb', line 70 def initialize(first_bucket_max = 0.010, bucket_count = 30, multiplier = 1.3) @buckets = [] min = 0 max = first_bucket_max (bucket_count - 1).times do @buckets << Bucket.new(min, max) min = max max *= multiplier end @buckets << Bucket.new(max) end |
Instance Attribute Details
#buckets ⇒ Object (readonly)
Returns the value of attribute buckets.
66 67 68 |
# File 'lib/new_relic/histogram.rb', line 66 def buckets @buckets end |
Instance Method Details
#process(response_time) ⇒ Object
84 85 86 87 88 89 |
# File 'lib/new_relic/histogram.rb', line 84 def process(response_time) buckets.each do |bucket| found = bucket.process(response_time) return if found == 0 end end |