Module: SystemMetrics

Defined in:
lib/system_metrics.rb,
lib/system_metrics/store.rb,
lib/system_metrics/config.rb,
lib/system_metrics/engine.rb,
lib/system_metrics/version.rb,
lib/system_metrics/collector.rb,
lib/system_metrics/instrument.rb,
lib/system_metrics/middleware.rb,
lib/system_metrics/async_store.rb,
lib/system_metrics/nested_event.rb,
app/models/system_metrics/metric.rb,
lib/system_metrics/instrument/base.rb,
lib/system_metrics/instrument/rack.rb,
app/helpers/system_metrics/metrics_helper.rb,
lib/system_metrics/instrument/action_view.rb,
lib/system_metrics/instrument/action_mailer.rb,
lib/system_metrics/instrument/active_record.rb,
lib/system_metrics/instrument/action_controller.rb,
app/controllers/system_metrics/metrics_controller.rb,
lib/generators/system_metrics/install/install_generator.rb,
lib/generators/system_metrics/migration/migration_generator.rb

Defined Under Namespace

Modules: Generators, Instrument, MetricsHelper Classes: AsyncStore, Collector, Config, Engine, Metric, MetricsController, Middleware, NestedEvent, Store

Constant Summary collapse

VERSION =
"0.2.5"

Class Method Summary collapse

Class Method Details

.collecting?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/system_metrics.rb', line 18

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

.collection_offObject



14
15
16
# File 'lib/system_metrics.rb', line 14

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

.collection_onObject



10
11
12
# File 'lib/system_metrics.rb', line 10

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

.without_collectionObject



22
23
24
25
26
27
28
# File 'lib/system_metrics.rb', line 22

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