studio3104/fluent-plugin-graphite

emit transaction failed error_class=NoMethodError in logs

Closed this issue · 3 comments

hi there:

i seem to be having issues running the graphite plugin for fluentd with a very simple setup, but it doesn't appear to be a connection or configuration type problem, was wondering if you've seen this before.

here's my very simple td-agent.conf file:

<source>
  type forward
</source>

<match pw.**>
   type copy
   <store>
      type stdout
   </store>
   <store>
     type graphite
     host 10.0.0.245
     port 2003
     tag_for prefix
     name_key_pattern .
   </store>
</match>

then my django application sends JSON blobs to td-agent running on the same host and i see this in the td-agent logs:

2015-03-28 18:05:13 +0000 pw.fetch_remittances: {"user_emulated":false,"company":"demo","__event_type":"fetch_remittances","query_string":"order-by=actual_pay_date&order=desc&page=1&per_page=10","path":"/api/remittances/","user_email":"melgart+demo@gmail.com"}
2015-03-28 18:05:13 +0000 [warn]: emit transaction failed  error_class=NoMethodError error=#<NoMethodError: undefined method `to_f' for false:FalseClass>
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-graphite-0.0.5/lib/fluent/plugin/out_graphite.rb:84:in `block in format_metrics'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-graphite-0.0.5/lib/fluent/plugin/out_graphite.rb:76:in `each'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-graphite-0.0.5/lib/fluent/plugin/out_graphite.rb:76:in `format_metrics'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-graphite-0.0.5/lib/fluent/plugin/out_graphite.rb:56:in `block in emit'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/event.rb:55:in `call'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/event.rb:55:in `each'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-graphite-0.0.5/lib/fluent/plugin/out_graphite.rb:53:in `emit'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/output.rb:33:in `next'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/out_stdout.rb:49:in `emit'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/output.rb:33:in `next'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/out_copy.rb:73:in `emit'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/match.rb:36:in `emit'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/engine.rb:160:in `emit_stream'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/engine.rb:140:in `emit'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/in_forward.rb:168:in `on_message'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/in_forward.rb:235:in `call'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/in_forward.rb:235:in `block in on_read_msgpack'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/in_forward.rb:234:in `feed_each'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/in_forward.rb:234:in `on_read_msgpack'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/in_forward.rb:220:in `call'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/in_forward.rb:220:in `on_read'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/cool.io-1.1.1/lib/cool.io/io.rb:108:in `on_readable'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/cool.io-1.1.1/lib/cool.io/io.rb:170:in `on_readable'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/cool.io-1.1.1/lib/cool.io/loop.rb:96:in `run_once'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/cool.io-1.1.1/lib/cool.io/loop.rb:96:in `run'
  2015-03-28 18:05:13 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.55/lib/fluent/plugin/in_forward.rb:95:in `run'

was curious if you could point me in the right direction for this failure? thanks in advance.

Hi @melgart

This plugin is able to recieve only records has numeric value.
String also allows because strictly is sufficient that to_f is defined.

[1] pry(main)> 1.to_f
=> 1.0
[2] pry(main)> '1'.to_f
=> 1.0
[3] pry(main)> 's'.to_f
=> 0.0
[4] pry(main)> false.to_f
NoMethodError: undefined method `to_f' for false:FalseClass
from (pry):4:in `__pry__'
[5] pry(main)>

Suzuki-san:

thank you for your reply -- you helped me realize i'm not being very smart-- if i want to plot a chart in graphite, the data points probably need to be numeric in value, not json! thank you for your work on this plugin and sorry to waste your time with this.

matias