Class: HGAPI::Client
- Inherits:
-
Object
- Object
- HGAPI::Client
- Defined in:
- lib/hg_api/client.rb
Constant Summary collapse
- SUPPORTED_TRANSPORTS =
[:udp, :tcp, :http]
- HTTP_URI =
"https://hostedgraphite.com/api/v1/sink"- HOST =
'carbon.hostedgraphite.com'- PORT =
2003
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #metric(key, value, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 |
# File 'lib/hg_api/client.rb', line 11 def initialize( = {}) @default_transport = check_transport!([:via]) || :udp @api_key = ENV["HOSTED_GRAPHITE_API_KEY"] @disabled = @api_key.nil? end |
Instance Method Details
#metric(key, value, options = {}) ⇒ Object
17 18 19 20 |
# File 'lib/hg_api/client.rb', line 17 def metric(key, value, = {}) return if @disabled send_metric(key, value, check_transport!([:via]) || @default_transport) end |