Class: Yabeda::Histogram
Overview
Base class for complex metric for measuring time values that allow to calculate averages, percentiles, and so on.
Instance Attribute Summary collapse
-
#buckets ⇒ Object
readonly
Reader method for the
buckets
initializer parameter.
Attributes inherited from Metric
#adapter, #aggregation, #comment, #group, #name, #per, #tags, #unit
Instance Method Summary collapse
- #initialize(name, **options) ⇒ Object constructor
-
#measure(tags = {}, value = nil) ⇒ Object
rubocop: disable Metrics/MethodLength.
Methods inherited from Metric
#adapters, #get, #inspect, #values
Constructor Details
#initialize(name, **options) ⇒ Object
Instance Attribute Details
#buckets ⇒ Object (readonly)
Reader method for the buckets
initializer parameter.
7 |
# File 'lib/yabeda/histogram.rb', line 7 option :buckets |
Instance Method Details
#measure(tags = {}, value = nil) ⇒ Object
rubocop: disable Metrics/MethodLength
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/yabeda/histogram.rb', line 10 def measure( = {}, value = nil) if value.nil? ^ block_given? raise ArgumentError, "You must provide either numeric value or block for Yabeda::Histogram#measure!" end if block_given? starting = Process.clock_gettime(Process::CLOCK_MONOTONIC) yield value = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting) end = ::Yabeda::Tags.build(, group) values[] = value adapters.each_value do |adapter| adapter.perform_histogram_measure!(self, , value) end value end |