Class: Yabeda::Summary
Overview
Base class for complex metric for measuring time values that allow to calculate averages, percentiles, and so on.
Instance Attribute Summary
Attributes inherited from Metric
#adapter, #aggregation, #comment, #group, #name, #per, #tags, #unit
Instance Method Summary collapse
-
#observe(tags = {}, value = nil) ⇒ Object
rubocop: disable Metrics/MethodLength.
Methods inherited from Metric
#adapters, #get, #initialize, #inspect, #values
Constructor Details
This class inherits a constructor from Yabeda::Metric
Instance Method Details
#observe(tags = {}, value = nil) ⇒ Object
rubocop: disable Metrics/MethodLength
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/yabeda/summary.rb', line 8 def observe( = {}, value = nil) if value.nil? ^ block_given? raise ArgumentError, "You must provide either numeric value or block for Yabeda::Summary#observe!" 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_summary_observe!(self, , value) end value end |