fluent-plugin-td 0.9.10 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ Release 0.10.0 - 2011/10/16
3
+
4
+ * Use buf_file by default
5
+ * Updated to fluentd-0.10.0
6
+
7
+
2
8
  Release 0.9.10 - 2011/09/21
3
9
 
4
10
  * Enabled auto_create_table by default
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ begin
12
12
  #gemspec.homepage = "http://fluent.github.com/"
13
13
  gemspec.has_rdoc = false
14
14
  gemspec.require_paths = ["lib"]
15
- gemspec.add_dependency "fluent", "~> 0.9.14"
15
+ gemspec.add_dependency "fluentd", "~> 0.10.0"
16
16
  gemspec.add_dependency "td-client", "~> 0.8.0"
17
17
  gemspec.test_files = Dir["test/**/*.rb"]
18
18
  gemspec.files = Dir["bin/**/*", "lib/**/*", "test/**/*.rb"] +
@@ -47,5 +47,12 @@ end
47
47
  #
48
48
  #task :default => [VERSION_FILE, :build]
49
49
 
50
- task :default => [:build]
50
+ Rake::TestTask.new(:test) do |t|
51
+ t.libs << "test"
52
+ t.test_files = Dir["test/*.rb"].sort
53
+ t.verbose = true
54
+ #t.warning = true
55
+ end
56
+
57
+ task :default => [:build, :gemspec]
51
58
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.10
1
+ 0.10.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fluent-plugin-td}
8
- s.version = "0.9.10"
8
+ s.version = "0.10.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sadayuki Furuhashi"]
12
- s.date = %q{2011-09-21}
12
+ s.date = %q{2011-10-16}
13
13
  s.extra_rdoc_files = [
14
14
  "ChangeLog",
15
15
  "README.rdoc"
@@ -20,26 +20,30 @@ Gem::Specification.new do |s|
20
20
  "VERSION",
21
21
  "example.conf",
22
22
  "fluent-plugin-td.gemspec",
23
- "lib/fluent/plugin/out_tdlog.rb"
23
+ "lib/fluent/plugin/out_tdlog.rb",
24
+ "test/out_tdlog.rb"
24
25
  ]
25
26
  s.rdoc_options = ["--charset=UTF-8"]
26
27
  s.require_paths = ["lib"]
27
28
  s.rubygems_version = %q{1.3.7}
28
29
  s.summary = %q{Treasure Data plugin for Fluent event collector}
30
+ s.test_files = [
31
+ "test/out_tdlog.rb"
32
+ ]
29
33
 
30
34
  if s.respond_to? :specification_version then
31
35
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
32
36
  s.specification_version = 3
33
37
 
34
38
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
35
- s.add_runtime_dependency(%q<fluent>, ["~> 0.9.14"])
39
+ s.add_runtime_dependency(%q<fluentd>, ["~> 0.10.0"])
36
40
  s.add_runtime_dependency(%q<td-client>, ["~> 0.8.0"])
37
41
  else
38
- s.add_dependency(%q<fluent>, ["~> 0.9.14"])
42
+ s.add_dependency(%q<fluentd>, ["~> 0.10.0"])
39
43
  s.add_dependency(%q<td-client>, ["~> 0.8.0"])
40
44
  end
41
45
  else
42
- s.add_dependency(%q<fluent>, ["~> 0.9.14"])
46
+ s.add_dependency(%q<fluentd>, ["~> 0.10.0"])
43
47
  s.add_dependency(%q<td-client>, ["~> 0.8.0"])
44
48
  end
45
49
  end
@@ -4,9 +4,18 @@ module Fluent
4
4
  class TreasureDataLogOutput < BufferedOutput
5
5
  Plugin.register_output('tdlog', self)
6
6
 
7
- HOST = ENV['TD_API_SERVER'] || 'api.treasure-data.com'
8
- PORT = 80
7
+ host = 'api.treasure-data.com'
8
+ port = 80
9
+ if e = ENV['TD_API_SERVER']
10
+ host, port_ = e.split(':',2)
11
+ port_ = port_.to_i
12
+ port = port_ if port_ != 0
13
+ end
14
+
15
+ HOST = host
16
+ PORT = port
9
17
  USE_SSL = false
18
+ BASE_URL = ''
10
19
 
11
20
  def initialize
12
21
  require 'fileutils'
@@ -25,7 +34,8 @@ class TreasureDataLogOutput < BufferedOutput
25
34
  @record_size_limit = 32*1024*1024 # TODO
26
35
  @table_list = []
27
36
  @auto_create_table = true
28
- @flush_interval = 300 # overwrite default flush_interval from 1min to 5mins
37
+ @buffer_type = 'file' # overwrite default buffer_type
38
+ @flush_interval = 300 # overwrite default flush_interval to 5mins
29
39
  end
30
40
 
31
41
  def configure(conf)
@@ -101,9 +111,8 @@ class TreasureDataLogOutput < BufferedOutput
101
111
  def format_stream(tag, es)
102
112
  out = ''
103
113
  off = out.bytesize
104
- es.each {|event|
105
- record = event.record
106
- record['time'] = event.time
114
+ es.each {|time,record|
115
+ record['time'] = time
107
116
 
108
117
  if record.size > @key_num_limit
109
118
  raise "Too many number of keys (#{record.size} keys)" # TODO include summary of the record
data/test/out_tdlog.rb ADDED
@@ -0,0 +1,37 @@
1
+ require 'fluent/test'
2
+ require 'fluent/plugin/out_tdlog'
3
+
4
+ class TreasureDataLogOutputTest < Test::Unit::TestCase
5
+ def setup
6
+ Fluent::Test.setup
7
+ end
8
+
9
+ TMP_DIR = File.dirname(__FILE__) + "/tmp"
10
+
11
+ CONFIG = %[
12
+ apikey testkey
13
+ buffer_path #{TMP_DIR}/buffer
14
+ ]
15
+
16
+ def create_driver(conf = CONFIG)
17
+ Fluent::Test::BufferedOutputTestDriver.new(Fluent::TreasureDataLogOutput) do
18
+ def start
19
+ super
20
+ end
21
+
22
+ def write(chunk)
23
+ chunk.read
24
+ end
25
+ end.configure(conf)
26
+ end
27
+
28
+ def test_emit
29
+ d = create_driver
30
+
31
+ time = Time.parse("2011-01-02 13:14:15 UTC").to_i
32
+ d.emit({"a"=>1}, time)
33
+ d.emit({"a"=>2}, time)
34
+ d.run
35
+ end
36
+ end
37
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-td
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 9
9
8
  - 10
10
- version: 0.9.10
9
+ - 0
10
+ version: 0.10.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sadayuki Furuhashi
@@ -15,23 +15,23 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-21 00:00:00 +09:00
18
+ date: 2011-10-16 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: fluent
22
+ name: fluentd
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 39
29
+ hash: 55
30
30
  segments:
31
31
  - 0
32
- - 9
33
- - 14
34
- version: 0.9.14
32
+ - 10
33
+ - 0
34
+ version: 0.10.0
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -66,6 +66,7 @@ files:
66
66
  - example.conf
67
67
  - fluent-plugin-td.gemspec
68
68
  - lib/fluent/plugin/out_tdlog.rb
69
+ - test/out_tdlog.rb
69
70
  - ChangeLog
70
71
  - README.rdoc
71
72
  has_rdoc: true
@@ -102,5 +103,5 @@ rubygems_version: 1.3.7
102
103
  signing_key:
103
104
  specification_version: 3
104
105
  summary: Treasure Data plugin for Fluent event collector
105
- test_files: []
106
-
106
+ test_files:
107
+ - test/out_tdlog.rb