class Metrics::Handler

Internal: Responsible for taking a list or an Array of Metrics::Instrumenters and passing them to the driver.

Attributes

instrumenters[R]

Public Class Methods

handle(*instrumenters) click to toggle source
# File lib/metrics/handler.rb, line 8
def self.handle(*instrumenters)
  new(*instrumenters).handle
end
new(*instrumenters) click to toggle source
# File lib/metrics/handler.rb, line 12
def initialize(*instrumenters)
  @instrumenters = instrumenters
end

Public Instance Methods

handle() click to toggle source

Public: Writes all of the instrumenters to the driver.

Returns an Array of Metrics::Instrumenters that were written.

# File lib/metrics/handler.rb, line 19
def handle
  write(*instrumenters)
  return last_result
end

Private Instance Methods

configuration() click to toggle source
# File lib/metrics/handler.rb, line 39
def configuration
  Metrics.configuration
end
driver() click to toggle source
# File lib/metrics/handler.rb, line 35
def driver
  configuration.driver
end
last_result() click to toggle source

The result of the last instrumenter. This is the return value of the block being instrumented.

# File lib/metrics/handler.rb, line 27
def last_result
  instrumenters.last ? instrumenters.last.result : nil
end
write(*instrumenters) click to toggle source
# File lib/metrics/handler.rb, line 31
def write(*instrumenters)
  driver.write(*instrumenters)
end