Sha256: 2b0195c8007fe5e2ba035581c6937cb0c1c96e08c1d37410d77d910c1bd4676f

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

module InstrumentAllTheThings
  module Instrumentors
    DEFAULT_EXECUTION_COUNT_AND_TIMING_OPTIONS = { }.freeze

    EXECUTION_COUNT_AND_TIMING_WRAPPER = proc do |opts, context|
      proc do |klass, next_blk, actual_code|
        InstrumentAllTheThings.increment("#{context.stats_name(klass)}.executed")

        InstrumentAllTheThings.time("#{context.stats_name(klass)}.duration") do
          next_blk.call(klass, actual_code)
        end
      rescue
        InstrumentAllTheThings.increment("#{context.stats_name(klass)}.errored")
        raise
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
instrument_all_the_things-1.0.2 lib/instrument_all_the_things/instrumentors/execution_count_and_timing.rb
instrument_all_the_things-1.0.1 lib/instrument_all_the_things/instrumentors/execution_count_and_timing.rb
instrument_all_the_things-0.9.1.alpha lib/instrument_all_the_things/instrumentors/execution_count_and_timing.rb
instrument_all_the_things-0.9.0.alpha lib/instrument_all_the_things/instrumentors/execution_count_and_timing.rb