lib/measurometer.rb
# Runs a given block within a cascade of `instrument` blocks of all the
# added drivers.
#
#   Measurometer.instrument('do_foo') { compute! }
#
# unfolds to
#   Appsignal.instrument('do_foo') do
#     Statsd.timing('do_foo') do
#       compute!
#     end
#   end
#
# A driver must be reentrant and thread-safe - it should be possible
# to have multiple `instrument` calls open from different threads at the
# same time.
# The driver must support the same interface as the Measurometer class
# itself, minus the `drivers` and `instrument_instance_method` methods.
#
# @param block_name[String] under which path to push the metric
# @param blk[#call] the block to instrument
# @return [Object] the return value of &blk
Runs a given block within a cascade of `instrument` blocks of all the
added drivers.





A driver must be reentrant and thread-safe - it should be possible
to have multiple `instrument` calls open from different threads at the
same time.
The driver must support the same interface as the Measurometer class
itself, minus the `drivers` and `instrument_instance_method` methods.
Runs a given block within a cascade of ` instrument ` blocks of all the added drivers . A driver must be reentrant and thread - safe - it should be possible to have multiple ` instrument ` calls open from different threads at the same time . The driver must support the same interface as the Measurometer class itself minus the ` drivers ` and ` instrument_instance_method ` methods .
def instrument(block_name, &blk)
      return yield unless @drivers && @drivers.any? 
      @drivers.inject(blk) { |outer_block, driver|
        -> {
          driver.instrument(block_name, &outer_block)
        }
      }.call
    end
def instrument ( block_name , & blk ) return yield unless @drivers && @drivers . any? @drivers . inject ( blk ) { | outer_block , driver | -> { driver . instrument ( block_name , & outer_block ) } } . call end
Runs a given block within a cascade of `instrument` blocks of all the
added drivers.
Runs a given block within a cascade of ` instrument ` blocks of all the added drivers .
# The block wrapping business is not free
the return value of &blk
the return value of &blk
Object
block_name
under which path to push the metric
under which path to push the metric
blk
the block to instrument
the block to instrument