fluent-plugin-mongo 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/README.rdoc +5 -1
- data/VERSION +1 -1
- data/fluent-plugin-mongo.gemspec +1 -0
- data/lib/fluent/plugin/out_mongo.rb +3 -1
- data/test/helper.rb +2 -0
- data/test/plugin/test_in_mongo_tail.rb +2 -2
- data/test/plugin/test_out_mongo.rb +35 -0
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b6ccaa707cc9ac56e75260f5482ae641a07b9492bfdd897e37c4f28b3cb6d9a
|
|
4
|
+
data.tar.gz: abfa43c69e8565a83681f68dc6b390b84895e5939a985cb9403cb749f1275b55
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c881203d25fbbbec76d3dbbbc3ed9c92484552e0ea9869827b54d96a1ce7fb303cb49b1162f6fc66e3aa284fc6a07895202efe9a3cb3e811be3476c2dfe051cc
|
|
7
|
+
data.tar.gz: f447183d0f51b61d31f6b913242df7d6719d0f32efa79b23dfd4ea4f404fb30468ce29c8de68be0d45250360cc98829b341bc9040c15ae6fff9f21618b4f59cc
|
data/ChangeLog
CHANGED
data/README.rdoc
CHANGED
|
@@ -74,6 +74,10 @@ Use _mongo_ type in match.
|
|
|
74
74
|
# eg: my_id: "507f1f77bcf86cd799439011"
|
|
75
75
|
object_id_keys my_id
|
|
76
76
|
|
|
77
|
+
# Specify whether the operations should be executed in order (default: true).
|
|
78
|
+
# If false, continues to insert remaining documents even if some inserts fail.
|
|
79
|
+
ordered false
|
|
80
|
+
|
|
77
81
|
# Other buffer configurations here
|
|
78
82
|
</match>
|
|
79
83
|
|
|
@@ -101,7 +105,7 @@ Here is an example to use built-in placeholders:
|
|
|
101
105
|
</buffer>
|
|
102
106
|
</match>
|
|
103
107
|
|
|
104
|
-
In more detail, please refer to the officilal document for built-in placeholders: https://docs.fluentd.org/
|
|
108
|
+
In more detail, please refer to the officilal document for built-in placeholders: https://docs.fluentd.org/configuration/buffer-section#placeholders
|
|
105
109
|
|
|
106
110
|
=== mongo(tag mapped mode)
|
|
107
111
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.6.
|
|
1
|
+
1.6.3
|
data/fluent-plugin-mongo.gemspec
CHANGED
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |gem|
|
|
|
23
23
|
gem.add_development_dependency "simplecov", ">= 0.5.4"
|
|
24
24
|
gem.add_development_dependency "rr", ">= 1.0.0"
|
|
25
25
|
gem.add_development_dependency "test-unit", ">= 3.0.0"
|
|
26
|
+
gem.add_development_dependency "test-unit-rr", ">= 1.0.0"
|
|
26
27
|
gem.add_development_dependency "timecop", "~> 0.9.4"
|
|
27
28
|
gem.add_development_dependency "webrick", ">= 1.7.0"
|
|
28
29
|
end
|
|
@@ -65,6 +65,8 @@ module Fluent::Plugin
|
|
|
65
65
|
config_param :ssl_verify, :bool, default: false
|
|
66
66
|
config_param :ssl_ca_cert, :string, default: nil
|
|
67
67
|
|
|
68
|
+
desc "Whether the operations should be executed in order. If false, continues to insert remaining documents even if some inserts fail."
|
|
69
|
+
config_param :ordered, :bool, default: true
|
|
68
70
|
|
|
69
71
|
config_section :buffer do
|
|
70
72
|
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
|
@@ -355,7 +357,7 @@ module Fluent::Plugin
|
|
|
355
357
|
replace_value_of_hash(r)
|
|
356
358
|
end
|
|
357
359
|
|
|
358
|
-
get_collection(database, collection, @collection_options).insert_many(records)
|
|
360
|
+
get_collection(database, collection, @collection_options).insert_many(records, ordered: @ordered)
|
|
359
361
|
rescue Mongo::Error::BulkWriteError => e
|
|
360
362
|
log.warn "#{records.size - e.result["n_inserted"]} documents are not inserted. Maybe these documents are invalid as a BSON."
|
|
361
363
|
forget_collection(collection)
|
data/test/helper.rb
CHANGED
|
@@ -77,7 +77,7 @@ class MongoTailInputTest < Test::Unit::TestCase
|
|
|
77
77
|
options = {}
|
|
78
78
|
options[:database] = database_name
|
|
79
79
|
@client = ::Mongo::Client.new(["localhost:#{port}"], options)
|
|
80
|
-
@time = Time.now
|
|
80
|
+
@time = Time.at(Time.now.to_i)
|
|
81
81
|
Timecop.freeze(@time)
|
|
82
82
|
end
|
|
83
83
|
|
|
@@ -114,7 +114,7 @@ class MongoTailInputTest < Test::Unit::TestCase
|
|
|
114
114
|
time_key time
|
|
115
115
|
])
|
|
116
116
|
d.run(expect_records: 1, timeout: 5) do
|
|
117
|
-
@client[collection_name].insert_one({message: "test", tag: "user.defined", time: Time.at(Fluent::Engine.now)})
|
|
117
|
+
@client[collection_name].insert_one({message: "test", tag: "user.defined", time: Time.at(Fluent::Engine.now.to_i)})
|
|
118
118
|
end
|
|
119
119
|
events = d.events
|
|
120
120
|
assert_equal "user.defined", events[0][0]
|
|
@@ -67,6 +67,23 @@ class MongoOutputTest < ::Test::Unit::TestCase
|
|
|
67
67
|
assert_equal({capped: true, size: 100}, d.instance.collection_options)
|
|
68
68
|
assert_equal({ssl: false, write: {j: false}}, d.instance.client_options)
|
|
69
69
|
assert_nil d.instance.connection_string
|
|
70
|
+
assert_true d.instance.ordered
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_configure_with_disabled_ordered
|
|
74
|
+
d = create_driver(%[
|
|
75
|
+
@type mongo
|
|
76
|
+
database fluent_test
|
|
77
|
+
collection test_collection
|
|
78
|
+
|
|
79
|
+
ordered false
|
|
80
|
+
])
|
|
81
|
+
|
|
82
|
+
assert_equal('fluent_test', d.instance.database)
|
|
83
|
+
assert_equal('test_collection', d.instance.collection)
|
|
84
|
+
assert_equal('localhost', d.instance.host)
|
|
85
|
+
assert_equal(port, d.instance.port)
|
|
86
|
+
assert_false d.instance.ordered
|
|
70
87
|
end
|
|
71
88
|
|
|
72
89
|
def test_configure_with_connection_string
|
|
@@ -247,6 +264,24 @@ class MongoOutputTest < ::Test::Unit::TestCase
|
|
|
247
264
|
assert_equal({"expireAfterSeconds"=>120.0}, expire_after_hash)
|
|
248
265
|
end
|
|
249
266
|
|
|
267
|
+
def test_write_with_disabled_ordered
|
|
268
|
+
d = create_driver(%[
|
|
269
|
+
@type mongo
|
|
270
|
+
connection_string mongodb://localhost:#{port}/#{database_name}
|
|
271
|
+
collection #{collection_name}
|
|
272
|
+
ordered false
|
|
273
|
+
])
|
|
274
|
+
|
|
275
|
+
mock_collection = Object.new
|
|
276
|
+
# Check the expected value is given as ordered parameter
|
|
277
|
+
mock(mock_collection).insert_many(anything, ordered: false)
|
|
278
|
+
stub(d.instance).get_collection { mock_collection }
|
|
279
|
+
|
|
280
|
+
d.run(default_tag: 'test') do
|
|
281
|
+
emit_documents(d)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
250
285
|
def test_overflow_integer_value
|
|
251
286
|
d = create_driver
|
|
252
287
|
d.run(default_tag: 'test') do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-mongo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masahiro Nakagawa
|
|
@@ -119,6 +119,20 @@ dependencies:
|
|
|
119
119
|
- - ">="
|
|
120
120
|
- !ruby/object:Gem::Version
|
|
121
121
|
version: 3.0.0
|
|
122
|
+
- !ruby/object:Gem::Dependency
|
|
123
|
+
name: test-unit-rr
|
|
124
|
+
requirement: !ruby/object:Gem::Requirement
|
|
125
|
+
requirements:
|
|
126
|
+
- - ">="
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: 1.0.0
|
|
129
|
+
type: :development
|
|
130
|
+
prerelease: false
|
|
131
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
132
|
+
requirements:
|
|
133
|
+
- - ">="
|
|
134
|
+
- !ruby/object:Gem::Version
|
|
135
|
+
version: 1.0.0
|
|
122
136
|
- !ruby/object:Gem::Dependency
|
|
123
137
|
name: timecop
|
|
124
138
|
requirement: !ruby/object:Gem::Requirement
|