Module: Metrics
- Defined in:
- lib/liquid/metrics.rb,
lib/liquid/metrics/reporter.rb,
lib/liquid/metrics/logger_reporter.rb
Defined Under Namespace
Classes: LoggerReporter, Reporter
Constant Summary
collapse
- @@registry =
MetricRegistry.new
- @@reporters =
[]
Class Method Summary
collapse
Class Method Details
.counter(name) ⇒ Object
42
43
44
|
# File 'lib/liquid/metrics.rb', line 42
def self.counter(name)
registry.counter(name)
end
|
.histogram(name) ⇒ Object
50
51
52
|
# File 'lib/liquid/metrics.rb', line 50
def self.histogram(name)
registry.histogram(name)
end
|
.meter(name) ⇒ Object
46
47
48
|
# File 'lib/liquid/metrics.rb', line 46
def self.meter(name)
registry.meter(name)
end
|
.registry ⇒ Object
38
39
40
|
# File 'lib/liquid/metrics.rb', line 38
def self.registry
@@registry
end
|
.start ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/liquid/metrics.rb', line 18
def self.start
@@reporters << JmxReporter.forRegistry(@@registry).build
@@reporters << LoggerReporter.new(@@registry)
@@reporters.each(&:start)
Signal.register_shutdown_handler { self.stop }
end
|
.stop ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/liquid/metrics.rb', line 26
def self.stop
@@reporters.each do |reporter|
if reporter.respond_to?(:run)
reporter.run
end
reporter.stop
end
@@reporters.clear
end
|
.timer(name) ⇒ Object
54
55
56
|
# File 'lib/liquid/metrics.rb', line 54
def self.timer(name)
registry.timer(name)
end
|