Module: Stats
- Defined in:
- lib/mas/stats.rb
Class Method Summary collapse
- .client ⇒ Object
- .gauge(*args) ⇒ Object
- .increment(*args) ⇒ Object
- .key ⇒ Object
- .time(*args, &block) ⇒ Object
Class Method Details
.client ⇒ Object
14 15 16 17 18 |
# File 'lib/mas/stats.rb', line 14 def self.client $statsd ||= Statsd.new('statsd.hostedgraphite.com', 8125).tap do |n| n.namespace = key end end |
.gauge(*args) ⇒ Object
6 7 8 |
# File 'lib/mas/stats.rb', line 6 def self.gauge(*args) client.gauge(*args) if key end |
.increment(*args) ⇒ Object
2 3 4 |
# File 'lib/mas/stats.rb', line 2 def self.increment(*args) client.increment(*args) if key end |
.key ⇒ Object
20 21 22 |
# File 'lib/mas/stats.rb', line 20 def self.key ENV['HOSTEDGRAPHITE_APIKEY'] end |
.time(*args, &block) ⇒ Object
10 11 12 |
# File 'lib/mas/stats.rb', line 10 def self.time(*args, &block) key ? client.time(*args, &block) : block.call end |