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
Class Method Details
.config ⇒ Object
Public: Returns the the configuration instance.
97 98 99 |
# File 'lib/meter/configuration.rb', line 97 def self.config @config ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
Public: Yields the configuration instance.
103 104 105 |
# File 'lib/meter/configuration.rb', line 103 def self.configure(&block) yield config end |
.reset! ⇒ Object
Public: Reset the configuration (useful for testing).
109 110 111 |
# File 'lib/meter/configuration.rb', line 109 def self.reset! @config = nil end |
Instance Method Details
#count(key, delta, options = {}) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/meter.rb', line 16 def count(key, delta, = {}) id = .delete(:id) primary.count key, delta, if id secondary.count "#{key}.#{id}", delta, end end |
#gauge(key, value, options = {}) ⇒ Object
24 25 26 |
# File 'lib/meter.rb', line 24 def gauge(key, value, = {}) primary.gauge key, value, end |
#histogram(key, value, options = {}) ⇒ Object
28 29 30 |
# File 'lib/meter.rb', line 28 def histogram(key, value, = {}) primary.histogram key, value, end |
#increment(key, options = {}) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/meter.rb', line 8 def increment(key, = {}) id = .delete(:id) primary.increment key, if id secondary.increment "#{key}.#{id}", end end |