Class: Fluent::EverySenseOutput
- Inherits:
-
BufferedOutput
- Object
- BufferedOutput
- Fluent::EverySenseOutput
- Includes:
- EverySenseProxy
- Defined in:
- lib/fluent/plugin/out_everysense.rb
Instance Method Summary collapse
- #add_send_time(record) ⇒ Object
-
#configure(conf) ⇒ Object
This method is called before starting.
- #configure_formatter(conf) ⇒ Object
- #format(tag, time, record) ⇒ Object
-
#shutdown ⇒ Object
This method is called when shutting down.
-
#start ⇒ Object
This method is called when starting.
- #write(chunk) ⇒ Object
Methods included from EverySenseProxy
#create_session, #create_session_request, #delete_session, #delete_session_request, #error_handler, #get_messages, #get_messages_params, #get_messages_request, included, #put_message, #put_message_request, #shutdown_proxy, #start_proxy, #target_path, #valid_session?
Instance Method Details
#add_send_time(record) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/fluent/plugin/out_everysense.rb', line 33 def add_send_time(record) if @send_time # send_time is recorded in ms record.merge({@send_time_key => Time.now.instance_eval { self.to_i * 1000 + (usec/1000) }}) else record end end |
#configure(conf) ⇒ Object
This method is called before starting. ‘conf’ is a Hash that includes configuration parameters. If the configuration is invalid, raise Fluent::ConfigError.
16 17 18 19 |
# File 'lib/fluent/plugin/out_everysense.rb', line 16 def configure(conf) super configure_formatter(conf) end |
#configure_formatter(conf) ⇒ Object
21 22 23 24 |
# File 'lib/fluent/plugin/out_everysense.rb', line 21 def configure_formatter(conf) @formatter = Plugin.new_formatter(@format) @formatter.configure(conf) end |
#format(tag, time, record) ⇒ Object
42 43 44 |
# File 'lib/fluent/plugin/out_everysense.rb', line 42 def format(tag, time, record) [tag, time, record].to_msgpack end |
#shutdown ⇒ Object
This method is called when shutting down. Shutdown the thread and close sockets or files here.
56 57 58 59 |
# File 'lib/fluent/plugin/out_everysense.rb', line 56 def shutdown shutdown_proxy super end |
#start ⇒ Object
This method is called when starting. Open sockets or files here.
28 29 30 31 |
# File 'lib/fluent/plugin/out_everysense.rb', line 28 def start super start_proxy end |
#write(chunk) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/fluent/plugin/out_everysense.rb', line 46 def write(chunk) chunk.msgpack_each do |tag, time, record| $log.debug "#{tag}, #{@formatter.format(tag, time, add_send_time(record)).chomp}\n" (@formatter.format(tag, time, add_send_time(record))) end $log.flush end |