fluent-mixin-type-converter 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: caa96f243ad1bbdcc64308f2252c8174e3369568
4
+ data.tar.gz: f918c29bbd8bbaee9384667c7fc01cee4ba5c2a7
5
+ SHA512:
6
+ metadata.gz: 069b9aa8f6f1e12c38ff1b2b9ac1d42b15f5968c1e9682c072948e1cfb4db35473c444977444021914cfcd97cf4c1363f2539782562c0c72f031919a1a3309dd
7
+ data.tar.gz: 4fbec76c7e4de0a354ba1c9ed5116b776bf8360c998d03ffe95c4029c9d88d27b9b6f62cd7aeaae114a0953988298b4acd2dcb518c33859d4db59385d9f5f0ab
@@ -1,6 +1,11 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.1.0
4
+ - 2.3.0
5
+ - 2.2
6
+ - 2.1
5
7
  - 2.0.0
6
8
  - 1.9.3
9
+
10
+ before_install:
11
+ - gem update bundler
data/README.md CHANGED
@@ -15,13 +15,13 @@ It supportes these type conversion.
15
15
  - time
16
16
  - array
17
17
 
18
- #### Option
18
+ #### Option Parameters
19
19
 
20
- * `types_delimiter`
21
- [default] `,`
20
+ * types_delimiter
21
+ * [default] `,`
22
22
 
23
- * `types_label_delimiter`
24
- [default] `:`
23
+ * types_label_delimiter
24
+ * [default] `:`
25
25
 
26
26
  ## Configuration
27
27
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-mixin-type-converter"
7
- spec.version = "0.0.3"
7
+ spec.version = "0.0.4"
8
8
  spec.authors = ["Kentaro Yoshida"]
9
9
  spec.email = ["y.ken.studio@gmail.com"]
10
10
  spec.summary = %q{Fluentd mixin plugin to provides type conversion function as like as in_tail plugin. It acts calling Fluent::TextParser::TypeConverter as mixin. It will let you get easy to implement type conversion for your own plugins.}
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.add_development_dependency "bundler"
20
20
  spec.add_development_dependency "rake"
21
+ spec.add_development_dependency "test-unit", ">= 3.1.0"
21
22
  spec.add_development_dependency "fluent-mixin-rewrite-tag-name"
22
- spec.add_runtime_dependency "fluentd", "~> 0.10.42"
23
+ spec.add_runtime_dependency "fluentd"
23
24
  end
@@ -10,17 +10,6 @@ module Fluent
10
10
  def configure(conf)
11
11
  super
12
12
 
13
- if types = conf['types']
14
- @types = types
15
- end
16
-
17
- if types_delimiter = conf['types_delimiter']
18
- @types_delimiter = types_delimiter
19
- end
20
-
21
- if types_label_delimiter = conf['types_label_delimiter']
22
- @types_label_delimiter = types_label_delimiter
23
- end
24
13
  end
25
14
 
26
15
  def filter_record(tag, time, record)
@@ -23,7 +23,6 @@ class TypeConverterMixinTest < Test::Unit::TestCase
23
23
  d = create_driver('unknown_keys')
24
24
  }
25
25
  d = create_driver(CONFIG)
26
- puts d.instance.inspect
27
26
  assert_equal 'code:integer,response_time:float', d.instance.config['types']
28
27
  end
29
28
 
@@ -67,27 +66,63 @@ class TypeConverterMixinTest < Test::Unit::TestCase
67
66
  def test_emit_all_types
68
67
  d1 = create_driver(%[
69
68
  tag test.message
70
- types string:string,integer:integer,float:float,bool:bool,time:time,array:array
69
+ types k_str:string,k_int:integer,k_float:float,k_bool:bool,k_time:time,k_array:array
71
70
  ], 'apache.access')
72
71
  d1.run do
73
72
  d1.emit({
74
- 'string' => 'foo',
75
- 'integer' => '500',
76
- 'float' => '0.5',
77
- 'bool' => 'true',
78
- 'time' => '2014-01-21 12:29:44 +0900',
79
- 'array' => 'foo,1,2.0,true'
73
+ 'k_str' => 'foo',
74
+ 'k_int' => '500',
75
+ 'k_float' => '0.5',
76
+ 'k_bool' => 'true',
77
+ 'k_time' => '2014-01-21 12:29:44 +0900',
78
+ 'k_array' => 'foo,1,2.0,true'
80
79
  })
81
80
  end
82
81
  emits = d1.emits
83
82
  assert_equal 1, emits.length
84
83
  p emits[0]
85
84
  assert_equal 'test.message', emits[0][0] # tag
86
- assert_equal 'foo', emits[0][2]['string']
87
- assert_equal 500, emits[0][2]['integer']
88
- assert_equal 0.5, emits[0][2]['float']
89
- assert_equal true, emits[0][2]['bool']
90
- assert_equal 1390274984, emits[0][2]['time']
91
- assert_equal ["foo", "1", "2.0", "true"], emits[0][2]['array']
85
+ assert_equal 'foo', emits[0][2]['k_str']
86
+ assert_equal 500, emits[0][2]['k_int']
87
+ assert_equal 0.5, emits[0][2]['k_float']
88
+ assert_equal true, emits[0][2]['k_bool']
89
+ assert_equal 1390274984, emits[0][2]['k_time']
90
+ assert_equal ["foo", "1", "2.0", "true"], emits[0][2]['k_array']
91
+ end
92
+
93
+ def test_emit_with_other_mixin
94
+ d1 = create_driver(%[
95
+ tag myapp.${tag}
96
+ remove_tag_prefix apache.
97
+ types code:integer
98
+ ], 'apache.access')
99
+ d1.run do
100
+ d1.emit({
101
+ 'code' => '200'
102
+ })
103
+ end
104
+ emits = d1.emits
105
+ assert_equal 1, emits.length
106
+ p emits[0]
107
+ assert_equal 'myapp.access', emits[0][0] # tag
108
+ assert_equal 200, emits[0][2]['code']
109
+ end
110
+
111
+ def test_emit_nocast_with_other_mixin
112
+ d1 = create_driver(%[
113
+ tag myapp.${tag}
114
+ remove_tag_prefix apache.
115
+ ], 'apache.access')
116
+ d1.run do
117
+ d1.emit({
118
+ 'code' => '200'
119
+ })
120
+ end
121
+ emits = d1.emits
122
+ assert_equal 1, emits.length
123
+ p emits[0]
124
+ assert_equal 'myapp.access', emits[0][0] # tag
125
+ assert_equal '200', emits[0][2]['code']
92
126
  end
93
127
  end
128
+
metadata CHANGED
@@ -1,80 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-mixin-type-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kentaro Yoshida
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-21 00:00:00.000000000 Z
11
+ date: 2016-02-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: fluent-mixin-rewrite-tag-name
48
57
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
58
  requirements:
51
- - - ! '>='
59
+ - - ">="
52
60
  - !ruby/object:Gem::Version
53
61
  version: '0'
54
62
  type: :development
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
65
  requirements:
59
- - - ! '>='
66
+ - - ">="
60
67
  - !ruby/object:Gem::Version
61
68
  version: '0'
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: fluentd
64
71
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
72
  requirements:
67
- - - ~>
73
+ - - ">="
68
74
  - !ruby/object:Gem::Version
69
- version: 0.10.42
75
+ version: '0'
70
76
  type: :runtime
71
77
  prerelease: false
72
78
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
79
  requirements:
75
- - - ~>
80
+ - - ">="
76
81
  - !ruby/object:Gem::Version
77
- version: 0.10.42
82
+ version: '0'
78
83
  description:
79
84
  email:
80
85
  - y.ken.studio@gmail.com
@@ -82,8 +87,8 @@ executables: []
82
87
  extensions: []
83
88
  extra_rdoc_files: []
84
89
  files:
85
- - .gitignore
86
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".travis.yml"
87
92
  - Gemfile
88
93
  - LICENSE
89
94
  - README.md
@@ -96,27 +101,26 @@ files:
96
101
  homepage: https://github.com/y-ken/fluent-mixin-type-converter
97
102
  licenses:
98
103
  - Apache License, Version 2.0
104
+ metadata: {}
99
105
  post_install_message:
100
106
  rdoc_options: []
101
107
  require_paths:
102
108
  - lib
103
109
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
110
  requirements:
106
- - - ! '>='
111
+ - - ">="
107
112
  - !ruby/object:Gem::Version
108
113
  version: '0'
109
114
  required_rubygems_version: !ruby/object:Gem::Requirement
110
- none: false
111
115
  requirements:
112
- - - ! '>='
116
+ - - ">="
113
117
  - !ruby/object:Gem::Version
114
118
  version: '0'
115
119
  requirements: []
116
120
  rubyforge_project:
117
- rubygems_version: 1.8.23
121
+ rubygems_version: 2.5.2
118
122
  signing_key:
119
- specification_version: 3
123
+ specification_version: 4
120
124
  summary: Fluentd mixin plugin to provides type conversion function as like as in_tail
121
125
  plugin. It acts calling Fluent::TextParser::TypeConverter as mixin. It will let
122
126
  you get easy to implement type conversion for your own plugins.