Module: Instrumental
- Defined in:
- lib/instrumental.rb,
lib/instrumental/agent.rb,
lib/instrumental/railtie.rb,
lib/instrumental/configuration.rb,
lib/instrumental/intervalometer.rb
Defined Under Namespace
Classes: Agent, Configuration, Intervalometer, Railtie
Class Method Summary
collapse
Class Method Details
.boot! ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/instrumental.rb', line 15
def self.boot!
if @config.enabled?
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do
@config.logger.debug('Starting a new worker process')
Agent.instance.setup_and_run
end
PhusionPassenger.on_event(:stopping_worker_process) do
@config.logger.debug('Killing worker process')
Agent.instance.stop
end
else
@config.logger.debug('Starting a new worker process')
Agent.instance.setup_and_run
end
end
end
|
.config ⇒ Object
36
37
38
|
# File 'lib/instrumental.rb', line 36
def self.config
@config
end
|
11
12
13
|
# File 'lib/instrumental.rb', line 11
def self.configure
yield @config
end
|
.count(name, value = 1) ⇒ Object
40
41
42
|
# File 'lib/instrumental.rb', line 40
def self.count(name, value=1)
Agent.instance.report(:count, name, value)
end
|
.measure(name, value) ⇒ Object
44
45
46
|
# File 'lib/instrumental.rb', line 44
def self.measure(name, value)
Agent.instance.report(:measure, name, value)
end
|
.milestone(name) ⇒ Object
54
55
56
|
# File 'lib/instrumental.rb', line 54
def self.milestone(name)
Agent.instance.milestone(name)
end
|
.timer(name) ⇒ Object
48
49
50
51
52
|
# File 'lib/instrumental.rb', line 48
def self.timer(name)
start_time = Time.now
yield
self.measure(name, (Time.now - start_time) * 1000) end
|