Module: Meter
- Extended by:
- Meter
- Included in:
- Meter
- Defined in:
- lib/meter.rb,
lib/meter/backend.rb,
lib/meter/version.rb,
lib/meter/configuration.rb,
lib/meter/configuration.rb
Overview
Copy and paste from github.com/DataDog/dogstatsd-ruby/blob/master/lib/statsd.rb Changes:
-
The class is renamed to “Backend”
-
the logger class method points to meter’s logger
Defined Under Namespace
Modules: VERSION Classes: Backend, Configuration
Class Method Summary collapse
-
.config ⇒ Object
Public: Returns the the configuration instance.
-
.configure {|config| ... } ⇒ Object
Public: Yields the configuration instance.
-
.reset! ⇒ Object
Public: Reset the configuration (useful for testing).
Instance Method Summary collapse
- #count(key, delta, options = {}) ⇒ Object
- #gauge(key, value, options = {}) ⇒ Object
- #histogram(key, value, options = {}) ⇒ Object
- #increment(key, options = {}) ⇒ Object
- #log(key, data) ⇒ Object
Class Method Details
.config ⇒ Object
Public: Returns the the configuration instance.
126 127 128 |
# File 'lib/meter/configuration.rb', line 126 def self.config @config ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
Public: Yields the configuration instance.
132 133 134 |
# File 'lib/meter/configuration.rb', line 132 def self.configure(&block) yield config end |
.reset! ⇒ Object
Public: Reset the configuration (useful for testing).
138 139 140 |
# File 'lib/meter/configuration.rb', line 138 def self.reset! @config = nil end |
Instance Method Details
#count(key, delta, options = {}) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/meter.rb', line 17 def count(key, delta, = {}) id = .delete(:id) primary.count key, delta, if id counter.count "#{key}.#{id}", delta, end end |
#gauge(key, value, options = {}) ⇒ Object
25 26 27 |
# File 'lib/meter.rb', line 25 def gauge(key, value, = {}) primary.gauge key, value, end |
#histogram(key, value, options = {}) ⇒ Object
29 30 31 |
# File 'lib/meter.rb', line 29 def histogram(key, value, = {}) primary.histogram key, value, end |
#increment(key, options = {}) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/meter.rb', line 9 def increment(key, = {}) id = .delete(:id) primary.increment key, if id counter.increment "#{key}.#{id}", end end |
#log(key, data) ⇒ Object
33 34 35 |
# File 'lib/meter.rb', line 33 def log(key, data) meter.log(key, data) end |