Sha256: 3c0d63df04e44d6e272f7496c0ece25759da16fba9368a0c8d4c20f52d3e974d

Contents?: true

Size: 981 Bytes

Versions: 4

Compression:

Stored size: 981 Bytes

Contents

module SystemMetrics
  autoload :Collector,      'system_metrics/collector'
  autoload :Config,         'system_metrics/config'
  autoload :Middleware,     'system_metrics/middleware'
  autoload :NestedEvent,    'system_metrics/nested_event'
  autoload :Store,          'system_metrics/store'
  autoload :AsyncStore,     'system_metrics/async_store'
  autoload :Version,        'system_metrics/version'

  def self.collection_on
    Thread.current[:system_metrics_collecting] = true
  end

  def self.collection_off
    Thread.current[:system_metrics_collecting] = false
  end

  def collecting?
    Thread.current[:system_metrics_collecting] || false
  end

  def without_collection
    previously_collecting = collecting?
    SystemMetrics.collection_off
    yield if block_given?
  ensure
    SystemMetrics.collection_on if previously_collecting
  end

  module_function :collecting?, :without_collection
end

require 'system_metrics/instrument'
require 'system_metrics/engine'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
system-metrics-0.2.5 lib/system_metrics.rb
system-metrics-0.2.4 lib/system_metrics.rb
system-metrics-0.2.3 lib/system_metrics.rb
system-metrics-0.2.2 lib/system_metrics.rb