Class: Bosh::Monitor::TsdbConnection

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

Constant Summary

Constants inherited from TcpConnection

Bosh::Monitor::TcpConnection::BACKOFF_CEILING, Bosh::Monitor::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) ⇒ TsdbConnection

Returns a new instance of TsdbConnection.



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

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

Instance Method Details

#send_metric(name, timestamp, value, tags = {}) ⇒ Object



7
8
9
10
11
12
# File 'lib/bosh/monitor/protocols/tsdb_connection.rb', line 7

def send_metric(name, timestamp, value, tags = {})
  formatted_tags = tags.map { |tag| tag.join("=") }.sort.join(" ")
  command = "put #{name} #{timestamp} #{value} #{formatted_tags}\n"
  @logger.debug("[TSDB] >> #{command.chomp}")
  send_data(command)
end