fluent-plugin-yohoushi 0.1.1 → 0.1.2

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: a49f24e3f8a74c0b5c310d238ed10710532c7317
4
- data.tar.gz: 6dba30cb2b7d0e4adcb1c0b41692622bc94527c5
3
+ metadata.gz: b5ca313fd0763679536353b8ea54dd0cacc01c1f
4
+ data.tar.gz: 7399aa2381f7ce696d6f76f8e60358b00167ed2b
5
5
  SHA512:
6
- metadata.gz: 207e2fc941c229683499d4734bf1672b71004396c157063e05e9c1142fa429cc10b5e6fa9f501241e60f55c55aab2c803610cc04a9da269ff0c47805901c7e42
7
- data.tar.gz: 0c003a78f32b67258bfb68d43367cb297ba51a86964d44e407c3c76f26d81a26a9a9a355c1ede96cae43a0334292d4d5f20dd356ff25e567f3a981affb477b28
6
+ metadata.gz: 8359f7a3e43446fb0b917db7d5e59629b8b3acd2cec937d5bf13a4becd81e418d3dec5de2c5eea4282131887ce7639df3e3d6a615684476c59d62a10a63b6bb3
7
+ data.tar.gz: a07612a0d7927c3eeabb532f0271c5531e240067d830b80f7b5f4c8f36798b49a0ae777443341aab70a45a3b427407c8f6624322b1679f1128fe4a9082ba2bd9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.1.2 (2014/02/03)
2
+
3
+ Fixes:
4
+
5
+ * Revert background post. I met troubles that fluentd process does not die.
6
+
1
7
  ## 0.1.1 (2014/01/29)
2
8
 
3
9
  Enhancement:
@@ -8,7 +14,7 @@ Enhancement:
8
14
 
9
15
  Changes:
10
16
 
11
- * fluent-plugin-yohoushi is now a buffer plugin
17
+ * fluent-plugin-yohoushi is now a buffered plugin, it will post in background
12
18
 
13
19
  ## 0.0.5 (2014/01/25)
14
20
 
@@ -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.1"
6
+ s.version = "0.1.2"
7
7
  s.authors = ["Naotoshi Seo"]
8
8
  s.email = ["sonots@gmail.com"]
9
9
  s.homepage = "https://github.com/sonots/fluent-plugin-yohoushi"
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_runtime_dependency "fluentd"
22
+ s.add_runtime_dependency "growthforecast-client", ">= 0.62.4"
22
23
  s.add_runtime_dependency "multiforecast-client"
23
24
  s.add_runtime_dependency "yohoushi-client"
24
25
 
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
- class YohoushiOutput < BufferedOutput
2
+ class YohoushiOutput < Output
3
3
  Plugin.register_output('yohoushi', self)
4
4
 
5
5
  MAPPING_MAX_NUM = 20
@@ -32,17 +32,6 @@ module Fluent
32
32
  end
33
33
  end
34
34
  config_param :enable_ruby, :bool, :default => true # true for lower version compatibility
35
-
36
- # Override default parameters of Bufferedoutput options
37
- config_param :buffer_type, :string, :default => 'memory'
38
- config_param :flush_interval, :time, :default => 0 # we can not wait 1 minute to create 1 minute graphs (originally, 60)
39
- config_param :try_flush_interval, :float, :default => 1 # we would be able to shorten more
40
- config_param :retry_limit, :integer, :default => 0 # growthforecast requires a realtime post, so do not retry (originally, 17)
41
- config_param :retry_wait, :time, :default => 1.0
42
- config_param :max_retry_wait, :time, :default => nil
43
- config_param :num_threads, :integer, :default => 1
44
- config_param :queued_chunk_flush_interval, :time, :default => 1
45
-
46
35
  # for test
47
36
  attr_reader :client
48
37
  attr_reader :mapping
@@ -64,6 +53,11 @@ module Fluent
64
53
  @mapping[from] = to
65
54
  end
66
55
  @client = MultiForecast::Client.new('mapping' => @mapping) unless @mapping.empty?
56
+ @client.clients.each { |c|
57
+ c.connect_timeout = 5.0
58
+ c.send_timeout = 5.0
59
+ c.receive_timeout = 5.0
60
+ }
67
61
  end
68
62
  raise ConfigError, "Either of `base_uri` or `mapping1` must be specified" unless @client
69
63
 
@@ -116,31 +110,29 @@ module Fluent
116
110
  $log.warn "out_yohoushi: #{e.class} #{e.message} #{path} #{e.backtrace.first}"
117
111
  end
118
112
 
119
- def format(tag, time, record)
120
- [tag, time, record].to_msgpack
121
- end
122
-
123
- def write(chunk)
124
- chunk.msgpack_each do |tag, time, record|
125
- tag_parts = tag.split('.')
126
- tag_prefix = tag_prefix(tag_parts)
127
- tag_suffix = tag_suffix(tag_parts)
128
- placeholders = {
129
- 'tag' => tag,
130
- 'tags' => tag_parts, # for lower compatibility
131
- 'tag_parts' => tag_parts,
132
- 'tag_prefix' => tag_prefix,
133
- 'tag_suffix' => tag_suffix,
134
- 'hostname' => @hostname,
135
- }
136
- if @key_pattern
113
+ 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|
137
127
  record.each do |key, value|
138
128
  next unless key =~ @key_pattern
139
129
  placeholders['key'] = key
140
130
  path = expand_placeholder(@key_pattern_path, time, record, placeholders)
141
131
  post(path, value)
142
132
  end
143
- else # keys
133
+ end
134
+ else # keys
135
+ es.each do |time, record|
144
136
  @keys.each do |key, path|
145
137
  next unless value = record[key]
146
138
  placeholders['key'] = key
@@ -149,9 +141,10 @@ module Fluent
149
141
  end
150
142
  end
151
143
  end
144
+
145
+ chain.next
152
146
  rescue => e
153
147
  $log.warn "out_yohoushi: #{e.class} #{e.message} #{e.backtrace.first}"
154
- # Here, no raise of an error, so this BufferedOutput does not retry
155
148
  end
156
149
 
157
150
  def expand_placeholder(value, time, record, opts)
@@ -19,7 +19,7 @@ describe Fluent::YohoushiOutput do
19
19
  let(:yohoushi_base_uri) { 'http://localhost:4804' }
20
20
  let(:growthforecast_base_uri) { 'http://localhost:5125' }
21
21
  let(:tag) { 'test' }
22
- let(:driver) { Fluent::Test::BufferedOutputTestDriver.new(Fluent::YohoushiOutput, tag).configure(config) }
22
+ let(:driver) { Fluent::Test::OutputTestDriver.new(Fluent::YohoushiOutput, tag).configure(config) }
23
23
  let(:instance) { driver.instance }
24
24
 
25
25
  describe 'test configure' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-yohoushi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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-01-28 00:00:00.000000000 Z
11
+ date: 2014-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: growthforecast-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.62.4
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.62.4
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: multiforecast-client
29
43
  requirement: !ruby/object:Gem::Requirement