fluent-plugin-td 0.10.27 → 0.10.28

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: 668a4eb674a2ea968b1fe87b2f18a48f65c500f4
4
- data.tar.gz: efbee27ae80e7cd6091425ed2609e2f8ba2f3b1f
3
+ metadata.gz: 94a57a8ecc7cd03af85dfacdce2623dabf6862c7
4
+ data.tar.gz: 7e5046ff0e73947ce69d7d3daa40875f3c74be83
5
5
  SHA512:
6
- metadata.gz: edc948913205c4bee2b87fc41824701e6d2c45a8569379ee98a41a8e866f67d4eeb4aa9a6dc7fc48d71190e549768cf4fe6251d120a8bbc6f9bb82ebcb60057b
7
- data.tar.gz: 6c7b7d9e19501bbd357de9da7168fb4aa09d10636e5f3a617a3b201ded1d91fc8ba8f331866c65c7d312b9c131dfb81289af74e79f546855548267e0a96333fb
6
+ metadata.gz: 07b585a15dad7100ab91e7316c3248772233c70268139b6f762d02bdb8f356b9dbbe06b4c04dac015a92e483e2e4143c77d79ce7a66d6c0c5e4d489101de7645
7
+ data.tar.gz: fd1d7f3e57dad3acce19569a1e575b7c167c06209a9757a6517e3c8450b78e7e89eef026ab5562d47bd127c5925c3ed284d8982678e1a7283e8a08aeb94dd7c1
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Release 0.10.28 - 2015/10/28
2
+
3
+ * Remove tditem output plugin
4
+ * Fix temporary file handling on windows
5
+
6
+
1
7
  Release 0.10.27 - 2015/06/10
2
8
 
3
9
  * Add secret option to apikey parameter
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
17
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  gem.require_paths = ['lib']
19
+ gem.license = "Apache-2.0"
19
20
 
20
21
  gem.add_dependency "fluentd", [">= 0.10.27", "< 2"]
21
22
  gem.add_dependency "td-client", "~> 0.8.66"
@@ -171,6 +171,7 @@ module Fluent
171
171
 
172
172
  FileUtils.mkdir_p(@tmpdir) unless @tmpdir.nil?
173
173
  f = Tempfile.new("tdlog-#{chunk.key}-", @tmpdir)
174
+ f.binmode
174
175
 
175
176
  size = if @use_gzip_command
176
177
  gzip_by_command(chunk, f)
@@ -190,6 +191,7 @@ module Fluent
190
191
  chunk.path
191
192
  else
192
193
  w = Tempfile.new("gzip-tdlog-#{chunk.key}-", @tmpdir)
194
+ w.binmode
193
195
  chunk.write_to(w)
194
196
  w.close
195
197
  w.path
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
  module TreasureDataPlugin
3
- VERSION = '0.10.27'
3
+ VERSION = '0.10.28'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.27
4
+ version: 0.10.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Treasure Data, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-10 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -116,15 +116,14 @@ files:
116
116
  - Rakefile
117
117
  - example.conf
118
118
  - fluent-plugin-td.gemspec
119
- - lib/fluent/plugin/out_tditem.rb
120
119
  - lib/fluent/plugin/out_tdlog.rb
121
120
  - lib/fluent/plugin/td_plugin_util.rb
122
121
  - lib/fluent/plugin/td_plugin_version.rb
123
- - test/plugin/test_out_tditem.rb
124
122
  - test/plugin/test_out_tdlog.rb
125
123
  - test/test_helper.rb
126
124
  homepage: http://www.treasuredata.com/
127
- licenses: []
125
+ licenses:
126
+ - Apache-2.0
128
127
  metadata: {}
129
128
  post_install_message:
130
129
  rdoc_options: []
@@ -142,11 +141,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
141
  version: '0'
143
142
  requirements: []
144
143
  rubyforge_project:
145
- rubygems_version: 2.2.2
144
+ rubygems_version: 2.4.5.1
146
145
  signing_key:
147
146
  specification_version: 4
148
147
  summary: Treasure Data Cloud Data Service plugin for Fluentd
149
148
  test_files:
150
- - test/plugin/test_out_tditem.rb
151
149
  - test/plugin/test_out_tdlog.rb
152
150
  - test/test_helper.rb
@@ -1,101 +0,0 @@
1
- require 'td-client'
2
- require 'fluent/plugin/td_plugin_version'
3
-
4
- module Fluent
5
- class TreasureDataItemOutput < BufferedOutput
6
- Plugin.register_output('tditem', self)
7
-
8
- require_relative 'td_plugin_util'
9
- include TDPluginUtil
10
-
11
- IMPORT_SIZE_LIMIT = 32 * 1024 * 1024
12
-
13
- # To support log_level option since Fluentd v0.10.43
14
- unless method_defined?(:log)
15
- define_method(:log) { $log }
16
- end
17
-
18
- config_param :apikey, :string, :secret => true
19
- config_param :database, :string
20
- config_param :table, :string
21
- config_param :tmpdir, :string, :default => nil
22
- #config_param :auto_create_table, :bool, :default => true # TODO: implement if user wants this feature
23
-
24
- config_param :endpoint, :string, :default => TreasureData::API::NEW_DEFAULT_ENDPOINT
25
- config_param :use_ssl, :bool, :default => true
26
- config_param :http_proxy, :string, :default => nil
27
- config_param :connect_timeout, :integer, :default => nil
28
- config_param :read_timeout, :integer, :default => nil
29
- config_param :send_timeout, :integer, :default => nil
30
- config_set_default :buffer_type, 'file'
31
- config_set_default :flush_interval, 300
32
-
33
- def initialize
34
- super
35
-
36
- @auto_create_table = false
37
- @tmpdir_prefix = 'tditem-'.freeze
38
- @key_num_limit = 1024 # Item table default limitation
39
- @record_size_limit = 32 * 1024 * 1024 # TODO
40
- @empty_gz_data = TreasureData::API.create_empty_gz_data
41
- @user_agent = "fluent-plugin-td-item: #{TreasureDataPlugin::VERSION}".freeze
42
- end
43
-
44
- def configure(conf)
45
- super
46
-
47
- # overwrite default value of buffer_chunk_limit
48
- if @buffer.respond_to?(:buffer_chunk_limit=) && !conf.has_key?('buffer_chunk_limit')
49
- @buffer.buffer_chunk_limit = IMPORT_SIZE_LIMIT
50
- end
51
-
52
- validate_database_and_table_name(@database, @table, conf)
53
- @key = "#{@database}.#{@table}".freeze
54
- @use_ssl = parse_bool_parameter(@use_ssl) if @use_ssl.instance_of?(String)
55
- FileUtils.mkdir_p(@tmpdir) unless @tmpdir.nil?
56
- end
57
-
58
- def start
59
- super
60
-
61
- client_opts = {
62
- :ssl => @use_ssl, :http_proxy => @http_proxy, :user_agent => @user_agent, :endpoint => @endpoint,
63
- :connect_timeout => @connect_timeout, :read_timeout => @read_timeout, :send_timeout => @send_timeout
64
- }
65
- @client = TreasureData::Client.new(@apikey, client_opts)
66
-
67
- check_table_existence(@database, @table)
68
- end
69
-
70
- def emit(tag, es, chain)
71
- super(tag, es, chain, @key)
72
- end
73
-
74
- def format_stream(tag, es)
75
- out = ''
76
- off = out.bytesize
77
- es.each { |time, record|
78
- if record.size > @key_num_limit
79
- log.error "Too many number of keys (#{record.size} keys)" # TODO include summary of the record
80
- next
81
- end
82
-
83
- begin
84
- record.to_msgpack(out)
85
- rescue RangeError
86
- TreasureData::API.normalized_msgpack(record, out)
87
- end
88
-
89
- noff = out.bytesize
90
- sz = noff - off
91
- if sz > @record_size_limit
92
- # TODO don't raise error
93
- #raise "Size of a record too large (#{sz} bytes)" # TODO include summary of the record
94
- log.warn "Size of a record too large (#{sz} bytes): #{summarize_record(record)}"
95
- end
96
- off = noff
97
- }
98
- out
99
- end
100
- end
101
- end
@@ -1,99 +0,0 @@
1
- require 'test_helper'
2
- require 'fluent/plugin/out_tditem'
3
-
4
- class TreasureDataItemOutputTest < Test::Unit::TestCase
5
- def setup
6
- Fluent::Test.setup
7
- end
8
-
9
- DEFAULT_CONFIG = %[
10
- database test
11
- table table
12
- ]
13
-
14
- def create_driver(conf = DEFAULT_CONFIG)
15
- config = %[
16
- apikey testkey
17
- buffer_type memory
18
- ] + conf
19
-
20
- Fluent::Test::BufferedOutputTestDriver.new(Fluent::TreasureDataItemOutput) do
21
- def write(chunk)
22
- # TestDriver doesn't call acutual Output#emit so set key to get database and table in this place.
23
- chunk.instance_variable_set(:@key, @key)
24
- super(chunk)
25
- end
26
- end.configure(config)
27
- end
28
-
29
- def test_configure
30
- d = create_driver
31
-
32
- assert_equal('testkey', d.instance.apikey)
33
- assert_equal('test', d.instance.database)
34
- assert_equal('table', d.instance.table)
35
- assert_equal(true, d.instance.use_ssl)
36
- assert_equal('memory', d.instance.buffer_type)
37
- assert_equal(300, d.instance.flush_interval)
38
- end
39
-
40
- def test_configure_with_invalid_database
41
- assert_raise(Fluent::ConfigError) {
42
- create_driver(%[
43
- database a
44
- table table
45
- ])
46
- }
47
- end
48
-
49
- def test_configure_with_invalid_table
50
- assert_raise(Fluent::ConfigError) {
51
- create_driver(%[
52
- database test
53
- table 1
54
- ])
55
- }
56
- end
57
-
58
- def test_emit
59
- d = create_driver
60
- time, records = stub_seed_values
61
- stub_td_import_request(stub_request_body(records), d.instance.database, d.instance.table)
62
-
63
- records.each { |record|
64
- d.emit(record, time)
65
- }
66
- d.run
67
-
68
- assert_equal('TD1 testkey', @auth_header)
69
- end
70
-
71
- def test_emit_with_endpoint
72
- d = create_driver(DEFAULT_CONFIG + "endpoint foo.bar.baz")
73
- opts = {:endpoint => 'foo.bar.baz'}
74
- time, records = stub_seed_values
75
- stub_td_import_request(stub_request_body(records), d.instance.database, d.instance.table, opts)
76
-
77
- records.each { |record|
78
- d.emit(record, time)
79
- }
80
- d.run
81
-
82
- assert_equal('TD1 testkey', @auth_header)
83
- end
84
-
85
- def test_emit_with_too_many_keys
86
- d = create_driver(DEFAULT_CONFIG + "endpoint foo.bar.baz")
87
- opts = {:endpoint => 'foo.bar.baz'}
88
- time, _ = stub_seed_values
89
- stub_td_import_request(stub_request_body([]), d.instance.database, d.instance.table, opts)
90
-
91
- d.emit(create_too_many_keys_record, time)
92
- d.run
93
-
94
- assert_equal 0, d.emits.size
95
- assert d.instance.log.logs.select{ |line|
96
- line =~ / \[error\]: Too many number of keys/
97
- }.size == 1, "too many keys error is not logged"
98
- end
99
- end