Module: Meter
- Defined in:
- lib/meter.rb,
lib/meter/backend.rb,
lib/meter/version.rb,
lib/meter/backends.rb,
lib/meter/configure.rb,
lib/meter/configuration.rb
Defined Under Namespace
Modules: VERSION Classes: Backend, Configuration
Class Method Summary collapse
-
.backends ⇒ Object
Holds the currently known backends.
-
.config ⇒ Object
Public: Lazy-loads and returns the the configuration instance.
-
.configure {|config| ... } ⇒ Object
Public: Yields the configuration instance.
- .gauge(key, value, options = {}) ⇒ Object
- .histogram(key, value, options = {}) ⇒ Object
- .increment(key, options = {}) ⇒ Object
- .log(key, data) ⇒ Object
Class Method Details
.backends ⇒ Object
Holds the currently known backends.
8 9 10 11 12 13 14 |
# File 'lib/meter/backends.rb', line 8 def self.backends @backends ||= ::OpenStruct.new( datadog: ::Meter::Backend.new('127.0.0.1', 8125), counter: ::Meter::Backend.new('127.0.0.1', 3333), heka: ::Meter::Backend.new('127.0.0.1', 8128), ) end |
.config ⇒ Object
Public: Lazy-loads and returns the the configuration instance.
7 8 9 |
# File 'lib/meter/configure.rb', line 7 def self.config @config ||= ::Meter::Configuration.new end |
.configure {|config| ... } ⇒ Object
Public: Yields the configuration instance.
13 14 15 |
# File 'lib/meter/configure.rb', line 13 def self.configure(&block) yield config end |
.gauge(key, value, options = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/meter.rb', line 15 def self.gauge(key, value, = {}) backends.datadog.gauge key, value, rescue => exception ::Meter.config.logger.error exception.inspect end |
.histogram(key, value, options = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/meter.rb', line 22 def self.histogram(key, value, = {}) backends.datadog.histogram key, value, rescue => exception ::Meter.config.logger.error exception.inspect end |