fluent-plugin-keep-forward 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04dd9735323e7d372ac1de93fb8e68388adcb829
4
- data.tar.gz: f5d686d0988c06a1872779d52942a87ac7e3c7dd
3
+ metadata.gz: 75c69e5a185b2fd2c114c9c3956eae071db46ad9
4
+ data.tar.gz: 1c33c34aaaa7cd4034a2e94f3de1fd579e7dcd70
5
5
  SHA512:
6
- metadata.gz: 328e26c80f20cfbb506a6b777e7bdac47a927ae3280d24ccd351295941a91c67d48a20c4f5da5cd697ba05027a88723d8ef1ab41018fa7a9d974d5ef7e23ffc8
7
- data.tar.gz: d732e0a855fd81d8b5536c2a7aaa9edf9b038e33f5234b0e0af8ccfd38e732c9f2f947b2f8ec205cc07db73f9f537c967a8a8711b3375b2102e5e91dca399845
6
+ metadata.gz: 30ea2dc8ba742bffa43ab6c7d1df6e97884ad8225fde1a7c7b423d63cccdc76ea9eda70dc3035a71a54b8383d917691446664a374410b49e43c49bc093f4775d
7
+ data.tar.gz: 1093a335e42d0aa96834807c082b7524c5fd56c61a0d4640939be1d28085576c2b04a252f01b4ef8fefaacb8d9e95e039646a03757a219ff826336d7f90bf63e
@@ -1,3 +1,9 @@
1
+ ## 0.1.6 (2014/03/28)
2
+
3
+ Enhancements:
4
+
5
+ * Add `heartbeat_type none` to disable heartbeat
6
+
1
7
  ## 0.1.4 (2014/03/20)
2
8
 
3
9
  Fixes
data/README.md CHANGED
@@ -20,6 +20,11 @@ Following parameters are additionally available:
20
20
 
21
21
  Keepalive expired time. Default is nil (which means to keep connection as long as possible).
22
22
 
23
+ - heartbeat_type
24
+
25
+ The transport protocol to use for heartbeats. The default is “udp”, but you can select “tcp” as well.
26
+ Furthermore, in keep_forward, you can also select "none" to disable heartbeat.
27
+
23
28
  - keepforward
24
29
 
25
30
  `one` for keep forwarding all data to the one node.
@@ -0,0 +1,39 @@
1
+ <source>
2
+ type tail
3
+ path dummy.log
4
+ pos_file /var/tmp/_var_log_dummy.pos
5
+ format none
6
+ tag dummy.localhost
7
+ </source>
8
+ <match dummy.localhost>
9
+ type copy
10
+ <store>
11
+ type stdout
12
+ </store>
13
+ <store>
14
+ type keep_forward
15
+ flush_interval 0
16
+ buffer_queue_limit 312
17
+ buffer_chunk_limit 10m
18
+ num_threads 1
19
+ retry_wait 0.1
20
+ retry_limit 17
21
+ # max_retry_wait 131072
22
+ send_timeout 60s # 60s
23
+ # recover_wait 10s
24
+ heartbeat_type none # udp
25
+ # heartbeat_interval 1s
26
+ phi_threshold 70 # 8
27
+ hard_timeout 60s # 60s
28
+ keepalive true
29
+ <server>
30
+ host localhost
31
+ port 10000
32
+ </server>
33
+ <server>
34
+ host localhost
35
+ port 11000
36
+ # standby true
37
+ </server>
38
+ </store>
39
+ </match>
@@ -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-keep-forward"
6
- s.version = "0.1.4"
6
+ s.version = "0.1.6"
7
7
  s.authors = ["Naotoshi Seo"]
8
8
  s.email = ["sonots@gmail.com"]
9
9
  s.homepage = "https://github.com/sonots/fluent-plugin-keep-forward"
@@ -18,7 +18,19 @@ class Fluent::KeepForwardOutput < Fluent::ForwardOutput
18
18
  when 'tag'
19
19
  :tag
20
20
  else
21
- raise ConfigError, "out_keep_forward keepforward should be 'one' or 'tag'"
21
+ raise ::Fluent::ConfigError, "out_keep_forward keepforward should be 'one' or 'tag'"
22
+ end
23
+ end
24
+ config_param :heartbeat_type, :default => :udp do |val|
25
+ case val.downcase
26
+ when 'tcp'
27
+ :tcp
28
+ when 'udp'
29
+ :udp
30
+ when 'none' # custom
31
+ :none
32
+ else
33
+ raise ::Fluent::ConfigError, "forward output heartbeat type should be 'tcp' or 'udp', or 'none'"
22
34
  end
23
35
  end
24
36
 
@@ -28,6 +40,10 @@ class Fluent::KeepForwardOutput < Fluent::ForwardOutput
28
40
  def configure(conf)
29
41
  super
30
42
 
43
+ if @heartbeat_type == :none
44
+ @nodes = @nodes.map {|node| NonHeartbeatNode.new(node) }
45
+ end
46
+
31
47
  @node = {}
32
48
  @sock = {}
33
49
  @sock_expired_at = {}
@@ -53,7 +69,11 @@ class Fluent::KeepForwardOutput < Fluent::ForwardOutput
53
69
  end
54
70
 
55
71
  def shutdown
56
- super
72
+ @finished = true
73
+ @loop.watchers.each {|w| w.detach }
74
+ @loop.stop unless @heartbeat_type == :none # custom
75
+ @thread.join
76
+ @usock.close if @usock
57
77
  stop_watcher
58
78
  end
59
79
 
@@ -70,6 +90,37 @@ class Fluent::KeepForwardOutput < Fluent::ForwardOutput
70
90
  end
71
91
  end
72
92
 
93
+ # Override to disable heartbeat
94
+ def run
95
+ unless @heartbeat_type == :none
96
+ super
97
+ end
98
+ end
99
+
100
+ # Delegate to Node instance disabling heartbeat
101
+ class NonHeartbeatNode
102
+ extend Forwardable
103
+ attr_reader :node
104
+ def_delegators :@node, :standby?, :resolved_host, :resolve_dns!, :to_msgpack,
105
+ :name, :host, :port, :weight, :weight=, :standby=, :available=, :sockaddr
106
+
107
+ def initialize(node)
108
+ @node = node
109
+ end
110
+
111
+ def available?
112
+ true
113
+ end
114
+
115
+ def tick
116
+ false
117
+ end
118
+
119
+ def heartbeat(detect=true)
120
+ true
121
+ end
122
+ end
123
+
73
124
  # Override
74
125
  def write_objects(tag, chunk)
75
126
  return if chunk.empty?
@@ -81,9 +132,11 @@ class Fluent::KeepForwardOutput < Fluent::ForwardOutput
81
132
  send_data(node, tag, chunk)
82
133
  return
83
134
  rescue
135
+ rebuild_weight_array if @heartbeat_type == :none
84
136
  weight_send_data(tag, chunk)
85
137
  end
86
138
  else
139
+ rebuild_weight_array if @heartbeat_type == :none
87
140
  weight_send_data(tag, chunk)
88
141
  end
89
142
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-keep-forward
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
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-03-20 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -110,6 +110,7 @@ files:
110
110
  - LICENSE
111
111
  - README.md
112
112
  - Rakefile
113
+ - example/fluent.conf
113
114
  - fluent-plugin-keep-forward.gemspec
114
115
  - lib/fluent/plugin/out_keep_forward.rb
115
116
  - spec/out_keep_forward_spec.rb