fluent-plugin-mongo 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fluent-plugin-mongo.gemspec +1 -1
- data/lib/fluent/plugin/out_mongo.rb +7 -7
- data/lib/fluent/plugin/out_mongo_replset.rb +2 -5
- metadata +15 -19
- data/lib/fluent/plugin/mongo_ext.rb +0 -55
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.6
|
data/fluent-plugin-mongo.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
|
19
19
|
gem.add_dependency "fluentd", ">= 0.10.7"
|
20
|
-
gem.add_dependency "mongo",
|
20
|
+
gem.add_dependency "mongo", ">= 1.6.0"
|
21
21
|
gem.add_development_dependency "rake", ">= 0.9.2"
|
22
22
|
gem.add_development_dependency "simplecov", ">= 0.5.4"
|
23
23
|
gem.add_development_dependency "rr", ">= 1.0.0"
|
@@ -31,7 +31,6 @@ class MongoOutput < BufferedOutput
|
|
31
31
|
super
|
32
32
|
require 'mongo'
|
33
33
|
require 'msgpack'
|
34
|
-
require 'fluent/plugin/mongo_ext'
|
35
34
|
|
36
35
|
@clients = {}
|
37
36
|
@connection_options = {}
|
@@ -56,12 +55,6 @@ class MongoOutput < BufferedOutput
|
|
56
55
|
@collection_options[:max] = Config.size_value(conf['capped_max']) if conf.has_key?('capped_max')
|
57
56
|
end
|
58
57
|
|
59
|
-
if @buffer.respond_to?(:buffer_chunk_limit)
|
60
|
-
@buffer.buffer_chunk_limit = available_buffer_chunk_limit
|
61
|
-
else
|
62
|
-
$log.warn "#{Fluent::VERSION} does not have :buffer_chunk_limit. Be careful when insert large documents to MongoDB"
|
63
|
-
end
|
64
|
-
|
65
58
|
@connection_options[:safe] = @safe
|
66
59
|
|
67
60
|
# MongoDB uses BSON's Date for time.
|
@@ -73,6 +66,13 @@ class MongoOutput < BufferedOutput
|
|
73
66
|
end
|
74
67
|
|
75
68
|
def start
|
69
|
+
# From configure for avoding complex method dependency...
|
70
|
+
if @buffer.respond_to?(:buffer_chunk_limit)
|
71
|
+
@buffer.buffer_chunk_limit = available_buffer_chunk_limit
|
72
|
+
else
|
73
|
+
$log.warn "#{Fluent::VERSION} does not have :buffer_chunk_limit. Be careful when insert large documents to MongoDB"
|
74
|
+
end
|
75
|
+
|
76
76
|
super
|
77
77
|
end
|
78
78
|
|
@@ -46,14 +46,11 @@ class MongoOutputReplset < MongoOutput
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def parse_nodes(nodes)
|
49
|
-
nodes.split(',')
|
50
|
-
host, port = node.split(':')
|
51
|
-
[host, Integer(port)]
|
52
|
-
}
|
49
|
+
nodes.split(',')
|
53
50
|
end
|
54
51
|
|
55
52
|
def get_connection
|
56
|
-
db = Mongo::ReplSetConnection.new(
|
53
|
+
db = Mongo::ReplSetConnection.new(@nodes, @connection_options).db(@database)
|
57
54
|
authenticate(db)
|
58
55
|
end
|
59
56
|
|
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: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-01 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152542640 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,24 +21,21 @@ dependencies:
|
|
21
21
|
version: 0.10.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152542640
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mongo
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152542020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
33
|
-
- - <=
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 1.5.2
|
32
|
+
version: 1.6.0
|
36
33
|
type: :runtime
|
37
34
|
prerelease: false
|
38
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152542020
|
39
36
|
- !ruby/object:Gem::Dependency
|
40
37
|
name: rake
|
41
|
-
requirement: &
|
38
|
+
requirement: &2152541400 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
40
|
requirements:
|
44
41
|
- - ! '>='
|
@@ -46,10 +43,10 @@ dependencies:
|
|
46
43
|
version: 0.9.2
|
47
44
|
type: :development
|
48
45
|
prerelease: false
|
49
|
-
version_requirements: *
|
46
|
+
version_requirements: *2152541400
|
50
47
|
- !ruby/object:Gem::Dependency
|
51
48
|
name: simplecov
|
52
|
-
requirement: &
|
49
|
+
requirement: &2152540780 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
51
|
requirements:
|
55
52
|
- - ! '>='
|
@@ -57,10 +54,10 @@ dependencies:
|
|
57
54
|
version: 0.5.4
|
58
55
|
type: :development
|
59
56
|
prerelease: false
|
60
|
-
version_requirements: *
|
57
|
+
version_requirements: *2152540780
|
61
58
|
- !ruby/object:Gem::Dependency
|
62
59
|
name: rr
|
63
|
-
requirement: &
|
60
|
+
requirement: &2152539800 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
62
|
requirements:
|
66
63
|
- - ! '>='
|
@@ -68,7 +65,7 @@ dependencies:
|
|
68
65
|
version: 1.0.0
|
69
66
|
type: :development
|
70
67
|
prerelease: false
|
71
|
-
version_requirements: *
|
68
|
+
version_requirements: *2152539800
|
72
69
|
description: MongoDB plugin for Fluent event collector
|
73
70
|
email: repeatedly@gmail.com
|
74
71
|
executables:
|
@@ -87,7 +84,6 @@ files:
|
|
87
84
|
- bin/mongo-tail
|
88
85
|
- fluent-plugin-mongo.gemspec
|
89
86
|
- lib/fluent/plugin/in_mongo_tail.rb
|
90
|
-
- lib/fluent/plugin/mongo_ext.rb
|
91
87
|
- lib/fluent/plugin/mongo_util.rb
|
92
88
|
- lib/fluent/plugin/out_mongo.rb
|
93
89
|
- lib/fluent/plugin/out_mongo_backup.rb
|
@@ -111,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
107
|
version: '0'
|
112
108
|
segments:
|
113
109
|
- 0
|
114
|
-
hash: -
|
110
|
+
hash: -1733988723759885390
|
115
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
112
|
none: false
|
117
113
|
requirements:
|
@@ -120,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
116
|
version: '0'
|
121
117
|
segments:
|
122
118
|
- 0
|
123
|
-
hash: -
|
119
|
+
hash: -1733988723759885390
|
124
120
|
requirements: []
|
125
121
|
rubyforge_project:
|
126
122
|
rubygems_version: 1.8.10
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'mongo'
|
2
|
-
|
3
|
-
module Mongo
|
4
|
-
class Collection
|
5
|
-
# Temporary fix.
|
6
|
-
# See pull request 82: https://github.com/mongodb/mongo-ruby-driver/pull/82
|
7
|
-
def insert_documents(documents, collection_name=@name, check_keys=true, safe=false, flags={})
|
8
|
-
if flags[:continue_on_error]
|
9
|
-
message = BSON::ByteBuffer.new
|
10
|
-
message.put_int(1)
|
11
|
-
else
|
12
|
-
message = BSON::ByteBuffer.new("\0\0\0\0")
|
13
|
-
end
|
14
|
-
|
15
|
-
collect_on_error = !!flags[:collect_on_error]
|
16
|
-
error_docs = [] if collect_on_error
|
17
|
-
|
18
|
-
BSON::BSON_RUBY.serialize_cstr(message, "#{@db.name}.#{collection_name}")
|
19
|
-
documents =
|
20
|
-
if collect_on_error
|
21
|
-
documents.select do |doc|
|
22
|
-
begin
|
23
|
-
message.put_binary(BSON::BSON_CODER.serialize(doc, check_keys, true, @connection.max_bson_size).to_s)
|
24
|
-
true
|
25
|
-
rescue StandardError => e # StandardError will be replaced with BSONError
|
26
|
-
doc.delete(:_id)
|
27
|
-
error_docs << doc
|
28
|
-
false
|
29
|
-
end
|
30
|
-
end
|
31
|
-
else
|
32
|
-
documents.each do |doc|
|
33
|
-
message.put_binary(BSON::BSON_CODER.serialize(doc, check_keys, true, @connection.max_bson_size).to_s)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
raise InvalidOperation, "Exceded maximum insert size of 16,000,000 bytes" if message.size > 16_000_000
|
37
|
-
|
38
|
-
instrument(:insert, :database => @db.name, :collection => collection_name, :documents => documents) do
|
39
|
-
if safe
|
40
|
-
@connection.send_message_with_safe_check(Mongo::Constants::OP_INSERT, message, @db.name, nil, safe)
|
41
|
-
else
|
42
|
-
@connection.send_message(Mongo::Constants::OP_INSERT, message)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
doc_ids = documents.collect { |o| o[:_id] || o['_id'] }
|
47
|
-
if collect_on_error
|
48
|
-
return doc_ids, error_docs
|
49
|
-
else
|
50
|
-
doc_ids
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|