Class: Metrix::OpenTSDB

Inherits:
TcpReporter show all
Defined in:
lib/metrix/opentsdb.rb

Instance Attribute Summary

Attributes inherited from TcpReporter

#host, #port

Instance Method Summary collapse

Methods inherited from TcpReporter

#buffers, #flush, #initialize, #logger, #window_size

Constructor Details

This class inherits a constructor from Metrix::TcpReporter

Instance Method Details

#<<(metric) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/metrix/opentsdb.rb', line 8

def <<(metric)
  metric.metrics.each do |m|
    Metrix.logger.debug "buffering #{m.to_opentsdb}"
    buffers << m.to_opentsdb
    flush if buffers.count >= 1000
  end
rescue => err
  Metrix.logger.error "#{err.message} #{err.inspect}"
end

#serialize_metric(m) ⇒ Object



18
19
20
# File 'lib/metrix/opentsdb.rb', line 18

def serialize_metric(m)
  m.to_opentsdb
end