Class: Fluent::Plugin::GriddbOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::Plugin::GriddbOutput
- Includes:
- GridDBAuth, GridDBAuthParams, GridDBData
- Defined in:
- lib/fluent/plugin/out_griddb.rb
Constant Summary collapse
- DEFAULT_BUFFER_TYPE =
"memory"
- DEFAULT_FORMATTER =
"json"
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#format(tag, time, record) ⇒ Object
Format data is auto supported by Fluentd.
- #formatted_to_msgpack_binary? ⇒ Boolean
-
#handle_record(tag, time, record) ⇒ Object
Put record to server.
-
#initialize ⇒ GriddbOutput
constructor
A new instance of GriddbOutput.
- #multi_workers_ready? ⇒ Boolean
- #prefer_buffered_processing ⇒ Object
-
#process(tag, es) ⇒ Object
Overwrite when Not use buffer.
- #shutdown ⇒ Object
- #start ⇒ Object
-
#write(chunk) ⇒ Object
Overwrite when use buffer.
Methods included from GridDBData
#chunk_convert, #convert, #hash_to_array
Methods included from GridDBAuth
#create_request, #format_url, #send_request, #set_body
Methods included from GridDBAuthParams
Constructor Details
#initialize ⇒ GriddbOutput
Returns a new instance of GriddbOutput.
22 23 24 |
# File 'lib/fluent/plugin/out_griddb.rb', line 22 def initialize super end |
Instance Method Details
#configure(conf) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fluent/plugin/out_griddb.rb', line 35 def configure(conf) compat_parameters_convert(conf, :buffer, :formatter) super if @host.nil? || @host.empty? raise Fluent::ConfigError, "Host must be not null or empty" end if @cluster.nil? || @cluster.empty? raise Fluent::ConfigError, "Cluster must be not null or empty" end if @database.nil? || @database.empty? raise Fluent::ConfigError, "Database must be not null or empty" end if @container.nil? || @container.empty? raise Fluent::ConfigError, "Container must be not null or empty" end if @username.nil? || @username.empty? raise Fluent::ConfigError, "Username must be not null or empty" end if @password.nil? || @password.empty? raise Fluent::ConfigError, "Password must be not null or empty" end raise Fluent::ConfigError, "'tag' in chunk_keys is required." if !@chunk_key_tag && @buffered if @formatter_config = conf.elements('format').first log.warn "griddb out plugin is not support format section" end end |
#format(tag, time, record) ⇒ Object
Format data is auto supported by Fluentd
83 84 85 |
# File 'lib/fluent/plugin/out_griddb.rb', line 83 def format(tag, time, record) [time, record].to_msgpack end |
#formatted_to_msgpack_binary? ⇒ Boolean
87 88 89 |
# File 'lib/fluent/plugin/out_griddb.rb', line 87 def formatted_to_msgpack_binary? true end |
#handle_record(tag, time, record) ⇒ Object
Put record to server
96 97 98 99 |
# File 'lib/fluent/plugin/out_griddb.rb', line 96 def handle_record(tag, time, record) req, uri = create_request(record) send_request(req, uri) end |
#multi_workers_ready? ⇒ Boolean
91 92 93 |
# File 'lib/fluent/plugin/out_griddb.rb', line 91 def multi_workers_ready? true end |
#prefer_buffered_processing ⇒ Object
78 79 80 |
# File 'lib/fluent/plugin/out_griddb.rb', line 78 def prefer_buffered_processing @buffered end |
#process(tag, es) ⇒ Object
Overwrite when Not use buffer
102 103 104 105 106 107 |
# File 'lib/fluent/plugin/out_griddb.rb', line 102 def process(tag, es) es.each do |time, record| arrays_2 = convert(record) handle_record(tag, time, arrays_2) end end |
#shutdown ⇒ Object
74 75 76 |
# File 'lib/fluent/plugin/out_griddb.rb', line 74 def shutdown super end |
#start ⇒ Object
70 71 72 |
# File 'lib/fluent/plugin/out_griddb.rb', line 70 def start super end |
#write(chunk) ⇒ Object
Overwrite when use buffer
110 111 112 113 114 115 |
# File 'lib/fluent/plugin/out_griddb.rb', line 110 def write(chunk) tag = chunk..tag $real_container = extract_placeholders(@container, chunk) arrays_2 = chunk_convert(chunk) handle_record(tag, DateTime.now, arrays_2) end |