ffwd 0.1.2 → 0.1.3

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: 662d6ca5d2a1a07cf582c04a365f705c1cc807f9
4
- data.tar.gz: 1a823ac6b62d55c1b2751830a6ffcdbb13c92fd9
3
+ metadata.gz: d359f0408acc2d8dc01aefbe73d265da27a87588
4
+ data.tar.gz: 079caae120a06beb6907796af8f7fd750cf11ffe
5
5
  SHA512:
6
- metadata.gz: 1e8b9bf081c3883429a20a0be30c3f0b22203057061f45fe828f0a3b23ec8b193e58814915fcdc1e05193a1048a8fc1065adb44c2909ee64ac68575a0756fcf7
7
- data.tar.gz: 602b3ea6457cab25305334696046d1b21364a70327e91767df9fd3b321f52462d9f6d642604c22540ee3484a2e16aa61669cea3385b0f9be577cc8e6352c9c62
6
+ metadata.gz: cf92d43e1a7542b291bd46ef5ccb12cda382b881ce1c2addbb882debd1c66c39d449b9f1ddfff217a923ea94e9ea9bcd391db92a764d3e259777ac4054ecf922
7
+ data.tar.gz: 76daa87ebb9972b3cfeb095d2fea347de78ff1bb46cb998ddd19c40dccb95aeaa783b33c2758899e3988047c0f048ae91436c4952aabb9d0f6d58ab8f8c6a3da
@@ -20,6 +20,7 @@ module FFWD::Debug
20
20
  attr_reader :id
21
21
 
22
22
  def initialize id, channel, type
23
+ @id = id
23
24
  @type = type
24
25
  @clients = {}
25
26
 
@@ -27,7 +27,7 @@ module FFWD::Plugin::JSON
27
27
 
28
28
  DEFAULT_HOST = "localhost"
29
29
  DEFAULT_PORT = 19000
30
- DEFAULT_PROTOCOL = "tcp"
30
+ DEFAULT_PROTOCOL = {"line" => "tcp", "frame" => "udp"}
31
31
  DEFAULT_KIND = "line"
32
32
 
33
33
  register_plugin "json",
@@ -80,11 +80,22 @@ module FFWD::Plugin::JSON
80
80
  KINDS = {"frame" => FrameConnection, "line" => LineConnection}
81
81
 
82
82
  def self.setup_input opts, core
83
- protocol = FFWD.parse_protocol opts[:protocol] || DEFAULT_PROTOCOL
84
83
  kind = (opts[:kind] || DEFAULT_KIND).to_s
85
84
  raise "No such kind: #{kind}" unless connection = KINDS[kind]
85
+ protocol = FFWD.parse_protocol opts[:protocol] || DEFAULT_PROTOCOL[kind]
86
86
  opts[:host] ||= DEFAULT_HOST
87
87
  opts[:port] ||= DEFAULT_PORT
88
+
89
+ if connection == FrameConnection and protocol != FFWD::UDP
90
+ log.warning "When using :frame kind, you should use the UDP protocol." +
91
+ " Not #{protocol.family.to_s.upcase}"
92
+ end
93
+
94
+ if connection == LineConnection and protocol != FFWD::TCP
95
+ log.warning "When using :line kind, you should use the TCP protocol. " +
96
+ "Not #{protocol.family.to_s.upcase}"
97
+ end
98
+
88
99
  protocol.bind opts, core, log, connection
89
100
  end
90
101
 
@@ -38,7 +38,7 @@ module FFWD::Processor
38
38
  @emitter = emitter
39
39
  @cache_limit = opts[:cache_limit] || 1000
40
40
  @timeout = opts[:timeout] || 300
41
- @period = opts[:period] || 10
41
+ @period = opts[:period] || 30
42
42
  @cache = {}
43
43
  @timer = nil
44
44
 
@@ -146,15 +146,20 @@ module FFWD
146
146
  return
147
147
  end
148
148
 
149
+ # store buffer sizes for use in callbacks.
150
+ events_size = @events.size
151
+ metrics_size = @metrics.size
152
+
149
153
  @request.callback do
150
- increment :sent_events, @events.size
151
- increment :sent_metrics, @metrics.size
154
+ increment :sent_events, events_size
155
+ increment :sent_metrics, metrics_size
152
156
  @request = nil
153
157
  end
154
158
 
155
- @request.errback do
156
- increment :failed_events, @events.size
157
- increment :failed_metrics, @metrics.size
159
+ @request.errback do |e|
160
+ log.error "Failed to produce", e
161
+ increment :failed_events, events_size
162
+ increment :failed_metrics, metrics_size
158
163
  @request = nil
159
164
  end
160
165
  rescue => e
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module FFWD
17
- VERSION = "0.1.2"
17
+ VERSION = "0.1.3"
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffwd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John-John Tedro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-03 00:00:00.000000000 Z
12
+ date: 2014-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine