Class: Bosh::Monitor::GraphiteConnection

Inherits:
TcpConnection
  • Object
show all
Defined in:
lib/bosh/monitor/protocols/graphite_connection.rb

Constant Summary

Constants inherited from TcpConnection

TcpConnection::BACKOFF_CEILING, TcpConnection::MAX_RETRIES

Instance Attribute Summary

Attributes inherited from TcpConnection

#logger_name, #retries

Instance Method Summary collapse

Methods inherited from TcpConnection

#connection_completed, #increment_retries, #receive_data, #reset_retries, #retry_reconnect, #unbind

Constructor Details

#initialize(host, port) ⇒ GraphiteConnection

Returns a new instance of GraphiteConnection.



3
4
5
# File 'lib/bosh/monitor/protocols/graphite_connection.rb', line 3

def initialize(host, port)
  super("connection.graphite", host, port)
end

Instance Method Details

#send_metric(name, value, timestamp) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/bosh/monitor/protocols/graphite_connection.rb', line 7

def send_metric(name, value, timestamp)
  if name && value && timestamp
    command = "#{name} #{value} #{timestamp}\n"
    @logger.debug("[Graphite] >> #{command.chomp}")
    send_data(command)
  else
    @logger.warn("Missing graphite metrics (name: '#{name}', value: '#{value}', timestamp: '#{timestamp}')")
  end
end