fluent-plugin-mongo 0.7.3 → 0.7.4

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
  SHA1:
3
- metadata.gz: b4c03c163ad52a2f48b8fa88d69370d4c1ed0810
4
- data.tar.gz: cf0f26a570dcfaed4c24bde308446b36ba0c2cfd
3
+ metadata.gz: e0f06d14dcaa01affed6b682b47507f1316382b3
4
+ data.tar.gz: 45949ee4d712a3383a5d1d0950dbc4777023df67
5
5
  SHA512:
6
- metadata.gz: 871f0d9f4880db300354aff08ba51f1a9f07718e01e9b3527ee22c5be107bda3f4ce9e96d7d5ed431a7ed704eb90fe421ba178a357216a1e9070630ff33847dd
7
- data.tar.gz: 182460bff1536f1997c238537292cbb0a048af93ef74a2393e275b79b0ae969707336d4c3243cdfe50a8f717b3929ac8ab1cffd4b91a0e01c51499985dc035ee
6
+ metadata.gz: d46e3642f3e5ea270751f63d8f0e763d368e87a1d01c0bc87ef4b5e1f53c69dc866a7813129e3df0eda442c46850e57aa3e319397c96a77329347edf1828585f
7
+ data.tar.gz: 58520fb47980924087cd3daecc2e9913064dd8874e0ea1204be5af83132cf7bd66678a1b18dcf4e8c9f9786d74d8ec3232bf1bd8ce06d7f04ab84d5c1ead9440
data/.gitignore CHANGED
@@ -3,3 +3,5 @@
3
3
  /coverage/
4
4
  /vendor/
5
5
  Gemfile.lock
6
+ /test/plugin/data/
7
+ /test/tools/data/
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  rvm:
2
- - 1.9.2
3
2
  - 1.9.3
4
3
  - 2.0.0
5
- - 2.1.0
4
+ - 2.1
6
5
  - rbx
7
6
 
8
7
  before_script:
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Release 0.7.4 - 2014/11/10
2
+
3
+ * Sanitize keys of each hash of an array
4
+ * Add config_set_default to mongo_replset
5
+
6
+
1
7
  Release 0.7.3 - 2014/03/09
2
8
 
3
9
  * Add replace_dot_in_key_with and replace_dollar_in_key_with parameters to sanitize invalid key
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.3
1
+ 0.7.4
@@ -253,18 +253,25 @@ module Fluent
253
253
  version
254
254
  end
255
255
 
256
- def replace_key_of_hash(hash, pattern, replacement)
257
- result = Hash.new
258
- hash.each_pair do |k, v|
259
- k = k.gsub(pattern, replacement)
260
-
261
- if v.is_a?(Hash)
262
- result[k] = replace_key_of_hash(v, pattern, replacement)
263
- else
264
- result[k] = (v.dup rescue v)
256
+ def replace_key_of_hash(hash_or_array, pattern, replacement)
257
+ case hash_or_array
258
+ when Array
259
+ hash_or_array.map do |elm|
260
+ replace_key_of_hash(elm, pattern, replacement)
261
+ end
262
+ when Hash
263
+ result = Hash.new
264
+ hash_or_array.each_pair do |k, v|
265
+ k = k.gsub(pattern, replacement)
266
+
267
+ if v.is_a?(Hash) || v.is_a?(Array)
268
+ result[k] = replace_key_of_hash(v, pattern, replacement)
269
+ else
270
+ result[k] = v
271
+ end
265
272
  end
273
+ result
266
274
  end
267
- result
268
275
  end
269
276
  end
270
277
  end
@@ -4,6 +4,9 @@ module Fluent
4
4
  class MongoOutputReplset < MongoOutput
5
5
  Plugin.register_output('mongo_replset', self)
6
6
 
7
+ config_set_default :include_tag_key, false
8
+ config_set_default :include_time_key, true
9
+
7
10
  config_param :nodes, :string
8
11
  config_param :name, :string, :default => nil
9
12
  config_param :read, :string, :default => nil
@@ -25,6 +25,7 @@ class MongoOutputTest < Test::Unit::TestCase
25
25
  type mongo
26
26
  database #{MONGO_DB_DB}
27
27
  collection #{collection_name}
28
+ include_time_key true # TestDriver ignore config_set_default?
28
29
  ]
29
30
  end
30
31
 
@@ -136,15 +137,21 @@ class MongoOutputTest < Test::Unit::TestCase
136
137
 
137
138
  time = Time.parse("2011-01-02 13:14:15 UTC").to_i
138
139
  d.emit({
139
- "foo.bar" => {
140
+ "foo.bar1" => {
140
141
  "$foo$bar" => "baz"
141
- }
142
+ },
143
+ "foo.bar2" => [
144
+ {
145
+ "$foo$bar" => "baz"
146
+ }
147
+ ],
142
148
  }, time)
143
149
  d.run
144
150
 
145
151
  documents = get_documents
146
152
  assert_equal(1, documents.size)
147
- assert_equal("baz", documents[0]["foo_dot_bar"]["_dollar_foo$bar"])
153
+ assert_equal("baz", documents[0]["foo_dot_bar1"]["_dollar_foo$bar"])
154
+ assert_equal("baz", documents[0]["foo_dot_bar2"][0]["_dollar_foo$bar"])
148
155
  assert_equal(0, documents.select { |e| e.has_key?(Fluent::MongoOutput::BROKEN_DATA_KEY)}.size)
149
156
  end
150
157
 
@@ -231,6 +238,7 @@ class MongoReplOutputTest < MongoOutputTest
231
238
  collection #{collection_name}
232
239
  nodes #{build_seeds(3).join(',')}
233
240
  num_retries 30
241
+ include_time_key true # TestDriver ignore config_set_default?
234
242
  ]
235
243
  end
236
244
 
@@ -260,3 +268,4 @@ class MongoReplOutputTest < MongoOutputTest
260
268
  assert_equal({:ssl => false}, d.instance.connection_options)
261
269
  end
262
270
  end
271
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nakagawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-08 00:00:00.000000000 Z
11
+ date: 2014-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.2.0
131
+ rubygems_version: 2.2.2
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: MongoDB plugin for Fluentd