Class: Fluent::OutDatadogEvent
- Inherits:
-
Output
- Object
- Output
- Fluent::OutDatadogEvent
- Defined in:
- lib/fluent/plugin/out_datadog_event.rb
Instance Method Summary collapse
- #emit(tag, es, chain) ⇒ Object
-
#initialize ⇒ OutDatadogEvent
constructor
A new instance of OutDatadogEvent.
- #post_event(time, event_key, event_msg) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ OutDatadogEvent
18 19 20 21 22 23 |
# File 'lib/fluent/plugin/out_datadog_event.rb', line 18 def initialize super # require "dogapi" require "date" end |
Instance Method Details
#emit(tag, es, chain) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/fluent/plugin/out_datadog_event.rb', line 35 def emit(tag, es, chain) chain.next es.each do |time,record| post_event(time, "record", record) end end |
#post_event(time, event_key, event_msg) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fluent/plugin/out_datadog_event.rb', line 42 def post_event(time, event_key, event_msg) res = @dog.emit_event(Dogapi::Event.new( "#{event_msg}", :msg_title => @msg_title, :date_happend => time, :priority => @priority, # :host => @host, :tags => , :alert_type => @alert_type, :aggregation_key => @aggregation_key, :source_type_name => @source_type_name )) # for debug #puts "debug_out: #{res}\n" end |
#shutdown ⇒ Object
30 31 32 33 |
# File 'lib/fluent/plugin/out_datadog_event.rb', line 30 def shutdown @finished = true @thread.join end |
#start ⇒ Object
25 26 27 28 |
# File 'lib/fluent/plugin/out_datadog_event.rb', line 25 def start @dog = Dogapi::Client.new(@api_key, @app_key) @finished = false end |