Method: Fluent::DatadogOutput#format
- Defined in:
- lib/fluent/plugin/out_datadog.rb
#format(tag, time, record) ⇒ Object
This method is called when an event reaches Fluentd.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/fluent/plugin/out_datadog.rb', line 116 def format(tag, time, record) # When Fluent::EventTime is msgpack'ed it gets converted to int with seconds # precision only. We explicitly convert it to floating point number, which # is compatible with Time.at below. record = enrich_record(tag, time.to_f, record) if @use_http record = JSON.generate(record) else if @use_json record = "#{api_key} #{JSON.generate(record)}" else record = "#{api_key} #{record}" end end [record].to_msgpack end |