Module: Harness

Defined in:
lib/harness.rb,
lib/harness/version.rb,
lib/harness/sync_queue.rb,
lib/harness/async_queue.rb,
lib/harness/fake_collector.rb,
lib/harness/null_collector.rb,
lib/harness/instrumentation.rb

Defined Under Namespace

Modules: Instrumentation Classes: AsyncQueue, Config, Counter, FakeCollector, Measurement, NullCollector, SyncQueue, Timer

Constant Summary collapse

VERSION =
"2.0.0"

Class Method Summary collapse

Class Method Details

.collectorObject



93
94
95
# File 'lib/harness.rb', line 93

def self.collector
  config.collector
end

.configObject



58
59
60
# File 'lib/harness.rb', line 58

def self.config
  @config ||= Config.new
end

.count(*args) ⇒ Object



74
75
76
# File 'lib/harness.rb', line 74

def self.count(*args)
  queue.push [:count, args]
end

.decrement(*args) ⇒ Object



66
67
68
# File 'lib/harness.rb', line 66

def self.decrement(*args)
  queue.push [:decrement, args]
end

.gauge(*args) ⇒ Object



85
86
87
# File 'lib/harness.rb', line 85

def self.gauge(*args)
  queue.push [:gauge, args]
end

.increment(*args) ⇒ Object



62
63
64
# File 'lib/harness.rb', line 62

def self.increment(*args)
  queue.push [:increment, args]
end

.queueObject



89
90
91
# File 'lib/harness.rb', line 89

def self.queue
  config.queue
end

.time(stat, sample_rate = 1) ⇒ Object



78
79
80
81
82
83
# File 'lib/harness.rb', line 78

def self.time(stat, sample_rate = 1)
  start = Time.now
  result = yield
  timing(stat, ((Time.now - start) * 1000).round, sample_rate)
  result
end

.timing(*args) ⇒ Object



70
71
72
# File 'lib/harness.rb', line 70

def self.timing(*args)
  queue.push [:timing, args]
end