module HostedGraphite

ANALYSE, is this implementation thread safe ?

Constants

VERSION

Attributes

api_key[W]
enabled[RW]
namespace[RW]
protocol[R]

Public Class Methods

count(*)
Alias for: testing
decrement(*)
Alias for: testing
gauge(*)
Alias for: testing
increment(*)
Alias for: testing
send_metric(*args) click to toggle source
# File lib/hosted_graphite.rb, line 28
def send_metric(*args)
  protocol.send_metric(*args) if enabled?
end
set(*)
Alias for: testing
testing(*) { || ... } click to toggle source
# File lib/hosted_graphite/testing.rb, line 20
def testing(*)
  yield if block_given?
end
Also aliased as: increment, decrement, count, gauge, set, timing, time
time(*)
Alias for: testing
timing(*)
Alias for: testing

Public Instance Methods

api_key() click to toggle source
# File lib/hosted_graphite.rb, line 20
def api_key
  @api_key ||= ENV['HOSTEDGRAPHITE_APIKEY']
end
enabled?() click to toggle source
# File lib/hosted_graphite.rb, line 24
def enabled?
  @enabled.nil? ? true : @enabled
end
protocol=(protocol) click to toggle source
# File lib/hosted_graphite.rb, line 33
def protocol=(protocol)
  protocol   = protocol.to_s.downcase
  require "hosted_graphite/protocols/#{protocol}"
  @protocol = @registred_protocols[protocol].new
end
send_message(message) click to toggle source
# File lib/hosted_graphite/testing.rb, line 13
def send_message(message)
  message
end
statsd() click to toggle source
# File lib/hosted_graphite/protocols/statsd.rb, line 23
def statsd
  @statsd ||= STATSD.new
end

Private Instance Methods

register(name, klass) click to toggle source
# File lib/hosted_graphite.rb, line 42
def register(name, klass)
  @registred_protocols[name] = klass
end
send_metric(*args) click to toggle source
# File lib/hosted_graphite.rb, line 28
def send_metric(*args)
  protocol.send_metric(*args) if enabled?
end