Class: Fluent::ArangoOutput

Inherits:
BufferedOutput
  • Object
show all
Includes:
SetTagKeyMixin, SetTimeKeyMixin
Defined in:
lib/fluent/plugin/out_arango.rb

Instance Method Summary collapse

Constructor Details

#initializeArangoOutput

Returns a new instance of ArangoOutput.



20
21
22
23
24
25
26
27
28
# File 'lib/fluent/plugin/out_arango.rb', line 20

def initialize
  super
  require 'ashikawa-core'
  require 'msgpack'

  @db = nil
  @conn = nil
  @col = nil
end

Instance Method Details

#configure(conf) ⇒ Object



30
31
32
# File 'lib/fluent/plugin/out_arango.rb', line 30

def configure(conf)
  super
end

#format(tag, time, record) ⇒ Object



51
52
53
# File 'lib/fluent/plugin/out_arango.rb', line 51

def format(tag, time, record)
  return record.to_msgpack
end

#shutdownObject



46
47
48
49
# File 'lib/fluent/plugin/out_arango.rb', line 46

def shutdown
  # MEMO: Ashikawa-Core has not finalize-method.
  super
end

#startObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/fluent/plugin/out_arango.rb', line 35

def start
  super

  @conn = Ashikawa::Core::Connection.new(get_arango_url)
  if @username && @password then
    @conn.authenticate_with(:username => @username, :password => @password)
  end
  @db = Ashikawa::Core::Database.new(@conn)
  @col = @db[@collection]
end

#write(chunk) ⇒ Object

def emit(tag, es, chain) end



58
59
60
61
62
63
# File 'lib/fluent/plugin/out_arango.rb', line 58

def write(chunk)
  # TODO: Change to bulk import if Ashikawa-core implemented.
  chunk.msgpack_each do |record|
    @col.create(record)
  end
end