fluent-plugin-elasticsearch 5.0.4 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7993521144deb5ebe2665d231cdeda9833cb4b3ba87909a2e21b96f8a43f61cc
4
- data.tar.gz: 25e0341fe8d2b131350fb521c520fa31314cdcf478914aaad2d4a3bdbf5a3954
3
+ metadata.gz: 0e7a5cd238a268dd3f141ce4ad1dedfacbacc98fdd22f73839bb0e1cdbccc586
4
+ data.tar.gz: 8077a55fae311fd0bd9cd84fc2b2eb34fad8f7a2a890b2707d37c7ac1c753975
5
5
  SHA512:
6
- metadata.gz: db5b6b3f9f4fc1e1d6a9c438e371aa73f962798f8a39519a01bfdeb38bfcb7a8b8e6b4efe20202108d518c33dd0701c29c20c7d4b7c0bb01b16f5907f34dea5d
7
- data.tar.gz: 8c69a02d9cda795457f104177773939eb53e652a74f4ebeab4d8dc2b6f943222f9ca967eeca93b0ca283f8be4fa5d381b1300f762d6b5d7e77a07bebb4194524
6
+ metadata.gz: 7bede6c6213db75e2636c6bf31e65b3256ae709ef600b9f3fca8973943344e07421daf4ed04fc0f3dd06f6b1f662c93c27d9240a323f8139aee3bf2a99ed0f9b
7
+ data.tar.gz: caed0a434434c903451cdd4b92ae4427ca39984a8405154308d70a2b68351c6a05b7e505c08cd776230cef9dbbda46f4256cd7de138f3549a1860b5b6cee8e3c
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.5', '2.6', '2.7', '3.0' ]
11
+ ruby: [ '2.6', '2.7', '3.0' ]
12
12
  os:
13
13
  - ubuntu-latest
14
14
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.5', '2.6', '2.7', '3.0' ]
11
+ ruby: [ '2.6', '2.7', '3.0' ]
12
12
  os:
13
13
  - macOS-latest
14
14
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.5', '2.6', '2.7', '3.0' ]
11
+ ruby: [ '2.6', '2.7', '3.0' ]
12
12
  os:
13
13
  - windows-latest
14
14
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
data/History.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 5.0.5
6
+ - Drop json_parse_exception messages for bulk failures (#900)
7
+ - GitHub Actions: Drop Ruby 2.5 due to EOL (#894)
8
+
5
9
  ### 5.0.4
6
10
  - test: out_elasticsearch: Remove a needless headers from affinity stub (#888)
7
11
  - Target Index Affinity (#883)
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'fluent-plugin-elasticsearch'
6
- s.version = '5.0.4'
6
+ s.version = '5.0.5'
7
7
  s.authors = ['diogo', 'pitr', 'Hiroshi Hatake']
8
8
  s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com', 'cosmo0920.wp@gmail.com']
9
9
  s.description = %q{Elasticsearch output plugin for Fluent event collector}
@@ -23,6 +23,10 @@ class Fluent::Plugin::ElasticsearchErrorHandler
23
23
  unrecoverable_error_types.include?(type)
24
24
  end
25
25
 
26
+ def unrecoverable_record_error?(type)
27
+ ['json_parse_exception'].include?(type)
28
+ end
29
+
26
30
  def log_es_400_reason(&block)
27
31
  if @plugin.log_es_400_reason
28
32
  block.call
@@ -53,6 +57,7 @@ class Fluent::Plugin::ElasticsearchErrorHandler
53
57
  meta, header, record = @plugin.process_message(tag, meta, header, time, processrecord, affinity_target_indices, extracted_values)
54
58
  next unless @plugin.append_record_to_messages(@plugin.write_operation, meta, header, record, bulk_message)
55
59
  rescue => e
60
+ @plugin.log.debug("Exception in error handler during deep copy: #{e}")
56
61
  stats[:bad_chunk_record] += 1
57
62
  next
58
63
  end
@@ -106,10 +111,15 @@ class Fluent::Plugin::ElasticsearchErrorHandler
106
111
  elsif item[write_operation].has_key?('error') && item[write_operation]['error'].has_key?('type')
107
112
  type = item[write_operation]['error']['type']
108
113
  stats[type] += 1
109
- retry_stream.add(time, rawrecord)
110
114
  if unrecoverable_error?(type)
111
115
  raise ElasticsearchRequestAbortError, "Rejected Elasticsearch due to #{type}"
112
116
  end
117
+ if unrecoverable_record_error?(type)
118
+ @plugin.router.emit_error_event(tag, time, rawrecord, ElasticsearchError.new("#{status} - #{type}: #{reason}"))
119
+ next
120
+ else
121
+ retry_stream.add(time, rawrecord) unless unrecoverable_record_error?(type)
122
+ end
113
123
  else
114
124
  # When we don't have a type field, something changed in the API
115
125
  # expected return values (ES 2.x)
@@ -38,7 +38,7 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
38
38
 
39
39
  def append_record_to_messages(op, meta, header, record, msgs)
40
40
  if record.has_key?('raise') && record['raise']
41
- raise Exception('process_message')
41
+ raise 'process_message'
42
42
  end
43
43
  return true
44
44
  end
@@ -307,7 +307,7 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
307
307
  def test_retry_error
308
308
  records = []
309
309
  error_records = Hash.new(false)
310
- error_records.merge!({0=>true, 4=>true, 9=>true})
310
+ error_records.merge!({0=>true, 4=>true})
311
311
  10.times do |i|
312
312
  records << {time: 12345, record: {"message"=>"record #{i}","_id"=>i,"raise"=>error_records[i]}}
313
313
  end
@@ -391,6 +391,18 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
391
391
  "reason":"unrecognized error"
392
392
  }
393
393
  }
394
+ },
395
+ {
396
+ "create" : {
397
+ "_index" : "foo",
398
+ "_type" : "bar",
399
+ "_id" : "9",
400
+ "status" : 500,
401
+ "error" : {
402
+ "type" : "json_parse_exception",
403
+ "reason":"Invalid UTF-8 start byte 0x92\\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@204fe9c9; line: 1, column: 81]"
404
+ }
405
+ }
394
406
  }
395
407
  ]
396
408
  }))
@@ -405,12 +417,12 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
405
417
  next unless e.respond_to?(:retry_stream)
406
418
  e.retry_stream.each {|time, record| records << record}
407
419
  end
408
- assert_equal 2, records.length
409
- assert_equal 2, records[0]['_id']
410
- assert_equal 8, records[1]['_id']
420
+ assert_equal 2, records.length, "Exp. retry_stream to contain records"
421
+ assert_equal 2, records[0]['_id'], "Exp record with given ID to in retry_stream"
422
+ assert_equal 8, records[1]['_id'], "Exp record with given ID to in retry_stream"
411
423
  error_ids = @plugin.error_events.collect {|h| h[:record]['_id']}
412
- assert_equal 3, error_ids.length
413
- assert_equal [5, 6, 7], error_ids
424
+ assert_equal 4, error_ids.length, "Exp. a certain number of records to be dropped from retry_stream"
425
+ assert_equal [5, 6, 7, 9], error_ids, "Exp. specific records to be dropped from retry_stream"
414
426
  @plugin.error_events.collect {|h| h[:error]}.each do |e|
415
427
  assert_true e.respond_to?(:backtrace)
416
428
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.4
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - diogo
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-06-07 00:00:00.000000000 Z
13
+ date: 2021-06-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd