fluent-plugin-yohoushi 0.1.3 → 0.1.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: 434ea006cc218fc90ffc87e46ce4bf72972ad097
4
- data.tar.gz: 62509e8cf32adb96e74e3ba3bc8d01fabd5d30b3
3
+ metadata.gz: 009579c5fe1829e9e6f143382b731f14db70bdd8
4
+ data.tar.gz: 5317d1d4c97630e359db08f9647b42cc1a1bd92d
5
5
  SHA512:
6
- metadata.gz: 66107ffa872e24abfeee664ac50d8d9cabc8230cf3ce834a9fd7b299b577e0c579847b98b0298a1eab2e8cad39213608256663a98be8451e35666ebc8356d2b2
7
- data.tar.gz: bab595411d0a16e534cfc3ac84a7ccb98b6f37b8a7371b7f9a2a3a5192293ecb8b18a3531b35654d9620b381f5d145b5bee5cbb3ef6db23463a87b36516e0a8d
6
+ metadata.gz: 0b8f71c962165ad1bf6da37a5b86d8d41c2a4702aa2f8c44a48aec7cd6146e6f59ff7e944a0590f102b38b16494fe6910f82b092fb0bfff17fd63c6aeb98ee8f
7
+ data.tar.gz: 212404e79646cab6efcd99df52f5e975e202ccff44e6fadb05f3fcf7a974c8f551afb6fa04f93f9de2267b7ce108364323f9f958a950a18cf8fd8728ce1b545c
@@ -1,5 +1,4 @@
1
1
  rvm:
2
- - 1.9.2
3
2
  - 1.9.3
4
3
  - 2.0.0
5
4
  gemfile:
@@ -1,3 +1,14 @@
1
+ ## 0.1.4 (2015/08/03)
2
+
3
+ Enhancement:
4
+
5
+ * report elapsed_time on debug log level
6
+ * Increase MAPPING_MAX_NUM and KEY_MAX_NUM to 1024
7
+
8
+ Other:
9
+
10
+ * Remove support for 1.9.2
11
+
1
12
  ## 0.1.3 (2014/02/04)
2
13
 
3
14
  Enhancement:
data/README.md CHANGED
@@ -9,7 +9,7 @@ Fluentd plugin to post data to yohoushi where [yohoushi](http://yohoushi.github.
9
9
  base_uri http://yohoushi.local:4804
10
10
  key1 foo_count /foobar/foo_count
11
11
  key2 bar_count /foobar/bar_count
12
- </source>
12
+ </match>
13
13
 
14
14
  Assuming following inputs are coming:
15
15
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-yohoushi"
6
- s.version = "0.1.3"
6
+ s.version = "0.1.4"
7
7
  s.authors = ["Naotoshi Seo"]
8
8
  s.email = ["sonots@gmail.com"]
9
9
  s.homepage = "https://github.com/sonots/fluent-plugin-yohoushi"
@@ -7,8 +7,8 @@ module Fluent
7
7
  define_method("log") { $log }
8
8
  end
9
9
 
10
- MAPPING_MAX_NUM = 20
11
- KEY_MAX_NUM = 20
10
+ MAPPING_MAX_NUM = 1024
11
+ KEY_MAX_NUM = 1024
12
12
 
13
13
  def initialize
14
14
  super
@@ -101,43 +101,47 @@ module Fluent
101
101
  end
102
102
 
103
103
  def post(path, number)
104
- if @enable_float_number
105
- @client.post_graph(path, { 'number' => number.to_f, 'mode' => @mode.to_s })
106
- else
107
- @client.post_graph(path, { 'number' => number.to_i, 'mode' => @mode.to_s })
104
+ report_time(" path:#{path}", "trace") do
105
+ if @enable_float_number
106
+ @client.post_graph(path, { 'number' => number.to_f, 'mode' => @mode.to_s })
107
+ else
108
+ @client.post_graph(path, { 'number' => number.to_i, 'mode' => @mode.to_s })
109
+ end
108
110
  end
109
111
  rescue => e
110
112
  log.warn "out_yohoushi: #{e.class} #{e.message} #{path} #{e.backtrace.first}"
111
113
  end
112
114
 
113
115
  def emit(tag, es, chain)
114
- tag_parts = tag.split('.')
115
- tag_prefix = tag_prefix(tag_parts)
116
- tag_suffix = tag_suffix(tag_parts)
117
- placeholders = {
118
- 'tag' => tag,
119
- 'tags' => tag_parts, # for lower compatibility
120
- 'tag_parts' => tag_parts,
121
- 'tag_prefix' => tag_prefix,
122
- 'tag_suffix' => tag_suffix,
123
- 'hostname' => @hostname,
124
- }
125
- if @key_pattern
126
- es.each do |time, record|
127
- record.each do |key, value|
128
- next unless key =~ @key_pattern
129
- placeholders['key'] = key
130
- path = expand_placeholder(@key_pattern_path, time, record, placeholders)
131
- post(path, value)
116
+ report_time(" tag:#{tag}", "debug") do
117
+ tag_parts = tag.split('.')
118
+ tag_prefix = tag_prefix(tag_parts)
119
+ tag_suffix = tag_suffix(tag_parts)
120
+ placeholders = {
121
+ 'tag' => tag,
122
+ 'tags' => tag_parts, # for lower compatibility
123
+ 'tag_parts' => tag_parts,
124
+ 'tag_prefix' => tag_prefix,
125
+ 'tag_suffix' => tag_suffix,
126
+ 'hostname' => @hostname,
127
+ }
128
+ if @key_pattern
129
+ es.each do |time, record|
130
+ record.each do |key, value|
131
+ next unless key =~ @key_pattern
132
+ placeholders['key'] = key
133
+ path = expand_placeholder(@key_pattern_path, time, record, placeholders)
134
+ post(path, value)
135
+ end
132
136
  end
133
- end
134
- else # keys
135
- es.each do |time, record|
136
- @keys.each do |key, path|
137
- next unless value = record[key]
138
- placeholders['key'] = key
139
- path = expand_placeholder(path, time, record, placeholders)
140
- post(path, value)
137
+ else # keys
138
+ es.each do |time, record|
139
+ @keys.each do |key, path|
140
+ next unless value = record[key]
141
+ placeholders['key'] = key
142
+ path = expand_placeholder(path, time, record, placeholders)
143
+ post(path, value)
144
+ end
141
145
  end
142
146
  end
143
147
  end
@@ -171,6 +175,13 @@ module Fluent
171
175
  rev_tag_suffix.reverse
172
176
  end
173
177
 
178
+ def report_time(msg = nil, level = "debug", &blk)
179
+ t = Time.now
180
+ output = yield
181
+ log.__send__(level, sprintf("out_yohoushi: elapsed_time:%.2f thread_id:%s%s caller:%s", (Time.now - t).to_f, Thread.current.object_id, msg, caller()[0]))
182
+ output
183
+ end
184
+
174
185
  class PlaceholderExpander
175
186
  attr_reader :placeholders
176
187
 
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-yohoushi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: growthforecast-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.62.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.62.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: multiforecast-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yohoushi-client
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry-nav
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Fluentd plugin to post data to yohoushi
@@ -129,10 +129,10 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
- - .gitignore
133
- - .pryrc
134
- - .rspec
135
- - .travis.yml
132
+ - ".gitignore"
133
+ - ".pryrc"
134
+ - ".rspec"
135
+ - ".travis.yml"
136
136
  - CHANGELOG.md
137
137
  - Gemfile
138
138
  - LICENSE
@@ -152,17 +152,17 @@ require_paths:
152
152
  - lib
153
153
  required_ruby_version: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - '>='
155
+ - - ">="
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  requirements:
160
- - - '>='
160
+ - - ">="
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
164
  rubyforge_project: fluent-plugin-yohoushi
165
- rubygems_version: 2.0.3
165
+ rubygems_version: 2.4.5
166
166
  signing_key:
167
167
  specification_version: 4
168
168
  summary: Fluentd plugin to post data to yohoushi