Sha256: c541043c90513975327c4d133ef32bd63ebc0a9fba3dd9acf1a74c94437d2af3

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 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 :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

3 entries across 3 versions & 1 rubygems

Version Path
system-metrics-0.2.1 lib/system_metrics.rb
system-metrics-0.2.0 lib/system_metrics.rb
system-metrics-0.1.0 lib/system_metrics.rb