Class: Fluent::MetricsBackendStatsd

Inherits:
MetricsBackend show all
Defined in:
lib/fluent/metrics_backends.rb

Instance Method Summary collapse

Methods inherited from MetricsBackend

#buffer?, #buffer_append, #buffer_append_array_of_hashes, #buffer_append_array_of_values, #buffer_append_entry, #buffer_dump, #buffer_flush, #get_connection_parameters, #initialize, #serialize, #serialize_array, #set_connection_parameters

Constructor Details

This class inherits a constructor from Fluent::MetricsBackend

Instance Method Details

#get_connection_parameters_defaultsObject



188
189
190
# File 'lib/fluent/metrics_backends.rb', line 188

def get_connection_parameters_defaults
  return { 'proto' => 'udp', 'host' => 'localhost', 'port' => 8215 }
end

#serialize_entry(entry, time) ⇒ Object



192
193
194
195
196
197
198
199
200
201
# File 'lib/fluent/metrics_backends.rb', line 192

def serialize_entry(entry,time)
  unless entry.nil? or not entry.key?('name') or not entry.key?('value') or entry['name'].empty? or not entry['value'].is_a?(Numeric)
    return sprintf(
      '%s%s:%s|c',
      entry.key?('prefix') ? entry['prefix'] + '.' : '',
      entry['name'],
      entry['value'].to_i
    )
  end
end