Class: Fluent::MetricsBackendGraphite

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



169
170
171
# File 'lib/fluent/metrics_backends.rb', line 169

def get_connection_parameters_defaults
  return { 'proto' => 'tcp', 'host' => 'localhost', 'port' => 2003 }
end

#serialize_entry(entry, time) ⇒ Object



173
174
175
176
177
178
179
180
181
182
# File 'lib/fluent/metrics_backends.rb', line 173

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 %i',
      entry.key?('prefix') ? entry['prefix'] + '.' : '',
      entry['name'],entry['value'].to_s,
      time.to_i
    )
  end
end