ffwd 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ffwd.rb +100 -36
- data/lib/ffwd/plugin.rb +25 -16
- data/lib/ffwd/plugin/json.rb +97 -0
- data/lib/ffwd/plugin/{json_line → json}/connection.rb +6 -14
- data/lib/ffwd/plugin/log.rb +6 -1
- data/lib/ffwd/processor/count.rb +17 -6
- data/lib/ffwd/version.rb +1 -1
- metadata +68 -58
- checksums.yaml +0 -7
- data/lib/ffwd/plugin/json_line.rb +0 -47
data/lib/ffwd.rb
CHANGED
@@ -22,6 +22,7 @@ require_relative 'ffwd/plugin'
|
|
22
22
|
require_relative 'ffwd/plugin_loader'
|
23
23
|
require_relative 'ffwd/processor'
|
24
24
|
require_relative 'ffwd/schema'
|
25
|
+
require_relative 'ffwd/version'
|
25
26
|
|
26
27
|
module FFWD
|
27
28
|
DEFAULT_PLUGIN_DIRECTORIES = [
|
@@ -80,7 +81,8 @@ module FFWD
|
|
80
81
|
def self.opts
|
81
82
|
@@opts ||= {:debug => false, :config => nil, :config_dir => nil,
|
82
83
|
:list_plugins => false, :list_schemas => false,
|
83
|
-
:dump_config => false,
|
84
|
+
:dump_config => false, :show_version => false,
|
85
|
+
:config_paths => [],
|
84
86
|
:plugin_directories => DEFAULT_PLUGIN_DIRECTORIES}
|
85
87
|
end
|
86
88
|
|
@@ -92,29 +94,33 @@ module FFWD
|
|
92
94
|
opts[:debug] = d
|
93
95
|
end
|
94
96
|
|
95
|
-
o.on "-c", "--config <path>" do |path|
|
96
|
-
opts[:
|
97
|
+
o.on "-c", "--config <path>", "Load the specified configuration file." do |path|
|
98
|
+
opts[:config_paths] << path
|
97
99
|
end
|
98
100
|
|
99
|
-
o.on "-d", "--config-
|
101
|
+
o.on "-d", "--config-directory <path>", "Load configuration files from the specified directory." do |path|
|
100
102
|
opts[:config_dir] = path
|
101
103
|
end
|
102
104
|
|
103
|
-
o.on "--
|
105
|
+
o.on "--plugins", "Print loaded and activated plugins." do
|
104
106
|
opts[:list_plugins] = true
|
105
107
|
end
|
106
108
|
|
107
|
-
o.on "--
|
109
|
+
o.on "--schemas", "Print available schemas." do
|
108
110
|
opts[:list_schemas] = true
|
109
111
|
end
|
110
112
|
|
111
|
-
o.on "--dump
|
113
|
+
o.on "--dump", "Dump the configuration that has been loaded." do
|
112
114
|
opts[:dump_config] = true
|
113
115
|
end
|
114
116
|
|
115
117
|
o.on "--plugin-directory <dir>", "Load plugins from the specified directory." do |dir|
|
116
118
|
opts[:plugin_directories] << dir
|
117
119
|
end
|
120
|
+
|
121
|
+
o.on "-v", "--version", "Show version." do
|
122
|
+
opts[:show_version] = true
|
123
|
+
end
|
118
124
|
end
|
119
125
|
end
|
120
126
|
|
@@ -137,24 +143,78 @@ module FFWD
|
|
137
143
|
plugins
|
138
144
|
end
|
139
145
|
|
146
|
+
def self.dump_loaded_plugins
|
147
|
+
FFWD::Plugin.loaded.each do |name, plugin|
|
148
|
+
puts " Plugin '#{name}'"
|
149
|
+
puts " Source: #{plugin.source}"
|
150
|
+
puts " Supports: #{plugin.capabilities.join(' ')}"
|
151
|
+
puts " Description: #{plugin.description}" if plugin.description
|
152
|
+
unless plugin.options.empty?
|
153
|
+
puts " Available Options:"
|
154
|
+
plugin.options.each do |opt|
|
155
|
+
puts " :#{opt[:name]} (default: #{opt[:default].inspect})"
|
156
|
+
puts " #{opt[:help]}" if opt[:help]
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.dump_activated_plugins plugins
|
163
|
+
plugins.each do |kind, kind_plugins|
|
164
|
+
puts " #{kind}:"
|
165
|
+
|
166
|
+
if kind_plugins.empty?
|
167
|
+
puts " (no active plugins)"
|
168
|
+
next
|
169
|
+
end
|
170
|
+
|
171
|
+
kind_plugins.each do |p|
|
172
|
+
puts " #{p.name}: #{p.config}"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def self.activated_plugins_warning
|
178
|
+
puts " NO ACTIVATED PLUGINS!"
|
179
|
+
puts ""
|
180
|
+
puts " 1) Did you specify a valid configuration?"
|
181
|
+
puts " Example ways to configure:"
|
182
|
+
puts " ffwd -c /etc/ffwd.conf"
|
183
|
+
puts " ffwd -d /etc/ffwd.d/"
|
184
|
+
puts ""
|
185
|
+
puts " 2) Are your plugins loaded?"
|
186
|
+
puts " Check with:"
|
187
|
+
puts " ffwd -c .. --list-plugins"
|
188
|
+
puts ""
|
189
|
+
puts " 3) Did any errors happen when loading the plugins?"
|
190
|
+
puts " Check with:"
|
191
|
+
puts " ffwd -c .. --debug"
|
192
|
+
puts ""
|
193
|
+
puts " 4) If you think you've stumbled on a bug, report it to:"
|
194
|
+
puts " https://github.com/spotify/ffwd"
|
195
|
+
end
|
196
|
+
|
140
197
|
def self.main args
|
141
198
|
parse_options args
|
142
199
|
|
200
|
+
if opts[:show_version]
|
201
|
+
puts "ffwd version: #{FFWD::VERSION}"
|
202
|
+
return 0
|
203
|
+
end
|
204
|
+
|
143
205
|
FFWD.log_config[:level] = opts[:debug] ? Logger::DEBUG : Logger::INFO
|
144
206
|
|
145
|
-
config = {
|
207
|
+
config = {}
|
146
208
|
|
147
|
-
|
148
|
-
unless File.file?
|
149
|
-
puts "Configuration path does not exist: #{
|
209
|
+
opts[:config_paths].each do |path|
|
210
|
+
unless File.file? path
|
211
|
+
puts "Configuration path does not exist: #{path}"
|
150
212
|
puts ""
|
151
213
|
puts parser.help
|
152
214
|
return 1
|
153
215
|
end
|
154
216
|
|
155
|
-
unless source = load_yaml(
|
156
|
-
return 0
|
157
|
-
end
|
217
|
+
return 0 unless source = load_yaml(path)
|
158
218
|
|
159
219
|
merge_configurations config, source
|
160
220
|
end
|
@@ -173,8 +233,12 @@ module FFWD
|
|
173
233
|
end
|
174
234
|
|
175
235
|
if config[:logging]
|
176
|
-
|
177
|
-
|
236
|
+
if opts[:debug]
|
237
|
+
puts "Ignoring :logging directive, --debug in effect"
|
238
|
+
else
|
239
|
+
config[:logging].each do |key, value|
|
240
|
+
FFWD.log_config[key] = value
|
241
|
+
end
|
178
242
|
end
|
179
243
|
end
|
180
244
|
|
@@ -202,27 +266,20 @@ module FFWD
|
|
202
266
|
|
203
267
|
plugins = setup_plugins config
|
204
268
|
|
205
|
-
|
206
|
-
puts "Available Plugins:"
|
207
|
-
|
208
|
-
FFWD::Plugin.loaded.each do |name, plugin|
|
209
|
-
puts "Plugin '#{name}' (#{plugin.source})"
|
210
|
-
puts " supports: #{plugin.capabilities.join(' ')}"
|
211
|
-
end
|
212
|
-
|
213
|
-
puts "Activated Plugins:"
|
214
|
-
|
215
|
-
plugins.each do |kind, kind_plugins|
|
216
|
-
puts "#{kind}:"
|
217
|
-
|
218
|
-
if kind_plugins.empty?
|
219
|
-
puts " (no active)"
|
220
|
-
end
|
269
|
+
all_empty = plugins.values.map(&:empty?).all?
|
221
270
|
|
222
|
-
|
223
|
-
|
224
|
-
|
271
|
+
if opts[:list_plugins]
|
272
|
+
puts ""
|
273
|
+
puts "Loaded Plugins:"
|
274
|
+
dump_loaded_plugins
|
275
|
+
puts ""
|
276
|
+
if all_empty
|
277
|
+
activated_plugins_warning
|
278
|
+
else
|
279
|
+
puts "Activated Plugins:"
|
280
|
+
dump_activated_plugins plugins
|
225
281
|
end
|
282
|
+
puts ""
|
226
283
|
end
|
227
284
|
|
228
285
|
if opts[:list_schemas]
|
@@ -235,7 +292,7 @@ module FFWD
|
|
235
292
|
end
|
236
293
|
|
237
294
|
if opts[:dump_config]
|
238
|
-
puts "
|
295
|
+
puts "Configuration:"
|
239
296
|
puts config
|
240
297
|
end
|
241
298
|
|
@@ -243,6 +300,13 @@ module FFWD
|
|
243
300
|
return 0
|
244
301
|
end
|
245
302
|
|
303
|
+
if all_empty
|
304
|
+
puts ""
|
305
|
+
activated_plugins_warning
|
306
|
+
puts ""
|
307
|
+
return 1
|
308
|
+
end
|
309
|
+
|
246
310
|
core = FFWD::Core.new plugins, config
|
247
311
|
core.run
|
248
312
|
return 0
|
data/lib/ffwd/plugin.rb
CHANGED
@@ -18,15 +18,17 @@ require_relative 'logging'
|
|
18
18
|
module FFWD
|
19
19
|
module Plugin
|
20
20
|
class Loaded
|
21
|
-
attr_reader :source, :name
|
21
|
+
attr_reader :source, :name, :description, :options
|
22
22
|
|
23
|
-
def initialize source, name,
|
23
|
+
def initialize source, name, config
|
24
24
|
@source = source
|
25
25
|
@name = name
|
26
|
-
@mod =
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
26
|
+
@mod = config[:mod]
|
27
|
+
@description = config[:description]
|
28
|
+
@options = config[:options]
|
29
|
+
@setup_input_method = load_method @mod, config[:setup_input_method_name]
|
30
|
+
@setup_output_method = load_method @mod, config[:setup_output_method_name]
|
31
|
+
@setup_tunnel_method = load_method @mod, config[:setup_tunnel_method_name]
|
30
32
|
end
|
31
33
|
|
32
34
|
def capabilities
|
@@ -69,10 +71,10 @@ module FFWD
|
|
69
71
|
class Setup
|
70
72
|
attr_reader :name, :config
|
71
73
|
|
72
|
-
def initialize name,
|
74
|
+
def initialize name, config, setup
|
73
75
|
@name = name
|
74
|
-
@setup = setup
|
75
76
|
@config = config
|
77
|
+
@setup = setup
|
76
78
|
end
|
77
79
|
|
78
80
|
def setup *args
|
@@ -90,7 +92,11 @@ module FFWD
|
|
90
92
|
|
91
93
|
module ClassMethods
|
92
94
|
def register_plugin(name, opts={})
|
93
|
-
options = {
|
95
|
+
options = {
|
96
|
+
:mod => self,
|
97
|
+
:description => opts[:description],
|
98
|
+
:options => opts[:options] || []
|
99
|
+
}
|
94
100
|
|
95
101
|
options[:setup_input_method_name] = (opts[:setup_input_method] || :setup_input)
|
96
102
|
options[:setup_output_method_name] = (opts[:setup_output_method] || :setup_output)
|
@@ -119,31 +125,34 @@ module FFWD
|
|
119
125
|
def self.load_plugins log, kind_name, config, kind
|
120
126
|
result = []
|
121
127
|
|
122
|
-
if config.nil?
|
123
|
-
return result
|
124
|
-
end
|
128
|
+
return result if config.nil?
|
125
129
|
|
126
130
|
config.each_with_index do |plugin_config, index|
|
127
131
|
d = "#{kind_name} plugin ##{index}"
|
128
132
|
|
129
|
-
|
133
|
+
unless name = plugin_config[:type]
|
130
134
|
log.error "#{d}: Missing :type attribute for '#{kind_name}'"
|
135
|
+
next
|
131
136
|
end
|
132
137
|
|
133
|
-
|
138
|
+
unless plugin = FFWD::Plugin.loaded[name]
|
134
139
|
log.error "#{d}: Not an available plugin '#{name}'"
|
135
140
|
next
|
136
141
|
end
|
137
142
|
|
138
|
-
unless plugin.
|
143
|
+
unless setup = plugin.get(kind)
|
139
144
|
log.error "#{d}: Not an #{kind_name} plugin '#{name}'"
|
140
145
|
next
|
141
146
|
end
|
142
147
|
|
143
|
-
result << Setup.new(name,
|
148
|
+
result << Setup.new(name, plugin_config, setup)
|
144
149
|
end
|
145
150
|
|
146
151
|
return result
|
147
152
|
end
|
153
|
+
|
154
|
+
def self.option name, opts={}
|
155
|
+
{:name => name, :default => opts[:default], :help => opts[:help]}
|
156
|
+
end
|
148
157
|
end
|
149
158
|
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# $LICENSE
|
2
|
+
# Copyright 2013-2014 Spotify AB. All rights reserved.
|
3
|
+
#
|
4
|
+
# The contents of this file are licensed under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with the
|
6
|
+
# License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
require 'eventmachine'
|
17
|
+
|
18
|
+
require 'ffwd/protocol'
|
19
|
+
require 'ffwd/plugin'
|
20
|
+
require 'ffwd/logging'
|
21
|
+
|
22
|
+
require_relative 'json/connection'
|
23
|
+
|
24
|
+
module FFWD::Plugin::JSON
|
25
|
+
include FFWD::Plugin
|
26
|
+
include FFWD::Logging
|
27
|
+
|
28
|
+
DEFAULT_HOST = "localhost"
|
29
|
+
DEFAULT_PORT = 19000
|
30
|
+
DEFAULT_PROTOCOL = "tcp"
|
31
|
+
|
32
|
+
register_plugin "json",
|
33
|
+
:description => "A simple JSON protocol implementation",
|
34
|
+
:options => [
|
35
|
+
FFWD::Plugin.option(
|
36
|
+
:kind, :default => :line,
|
37
|
+
:help => "Kind of protocol to use, valid options are: :frame and :line."),
|
38
|
+
FFWD::Plugin.option(
|
39
|
+
:protocol, :default => DEFAULT_PROTOCOL,
|
40
|
+
:help => "Protocol to use when receiving messages. When :kind is :frame, this should be 'udp'.")
|
41
|
+
]
|
42
|
+
|
43
|
+
class LineConnection < FFWD::Connection
|
44
|
+
include FFWD::Logging
|
45
|
+
include FFWD::Plugin::JSON::Connection
|
46
|
+
include EM::Protocols::LineText2
|
47
|
+
|
48
|
+
def self.plugin_type
|
49
|
+
"json_line_in"
|
50
|
+
end
|
51
|
+
|
52
|
+
def receive_line data
|
53
|
+
receive_json data
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class FrameConnection < FFWD::Connection
|
58
|
+
include FFWD::Logging
|
59
|
+
include FFWD::Plugin::JSON::Connection
|
60
|
+
|
61
|
+
def self.plugin_type
|
62
|
+
"json_frame_in"
|
63
|
+
end
|
64
|
+
|
65
|
+
def receive_data data
|
66
|
+
receive_json data
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
KINDS = {
|
71
|
+
:frame => FrameConnection,
|
72
|
+
:line => LineConnection,
|
73
|
+
}
|
74
|
+
|
75
|
+
def self.setup_input opts, core
|
76
|
+
opts[:host] ||= DEFAULT_HOST
|
77
|
+
opts[:port] ||= DEFAULT_PORT
|
78
|
+
protocol = FFWD.parse_protocol(opts[:protocol] || DEFAULT_PROTOCOL)
|
79
|
+
kind = opts[:kind] || :line
|
80
|
+
unless connection = KINDS[kind]
|
81
|
+
raise "No such kind: #{kind}"
|
82
|
+
end
|
83
|
+
|
84
|
+
protocol.bind opts, core, log, connection
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.setup_tunnel opts, core, tunnel
|
88
|
+
opts[:port] ||= DEFAULT_PORT
|
89
|
+
protocol = FFWD.parse_protocol(opts[:protocol] || "tcp")
|
90
|
+
kind = opts[:kind] || :line
|
91
|
+
unless connection = KINDS[kind]
|
92
|
+
raise "No such kind: #{kind}"
|
93
|
+
end
|
94
|
+
|
95
|
+
protocol.tunnel opts, core, tunnel, log, connection
|
96
|
+
end
|
97
|
+
end
|
@@ -18,11 +18,8 @@ require 'eventmachine'
|
|
18
18
|
require 'ffwd/logging'
|
19
19
|
require 'ffwd/connection'
|
20
20
|
|
21
|
-
module FFWD::Plugin::
|
22
|
-
|
23
|
-
include FFWD::Logging
|
24
|
-
include EM::Protocols::LineText2
|
25
|
-
|
21
|
+
module FFWD::Plugin::JSON
|
22
|
+
module Connection
|
26
23
|
EVENT_FIELDS = [
|
27
24
|
["key", :key],
|
28
25
|
["value", :value],
|
@@ -42,17 +39,12 @@ module FFWD::Plugin::JsonLine
|
|
42
39
|
["attributes", :attributes]
|
43
40
|
]
|
44
41
|
|
45
|
-
def
|
46
|
-
"json_line_in"
|
47
|
-
end
|
48
|
-
|
49
|
-
def initialize bind, core, buffer_limit
|
42
|
+
def initialize bind, core
|
50
43
|
@bind = bind
|
51
44
|
@core = core
|
52
|
-
@buffer_limit = buffer_limit
|
53
45
|
end
|
54
46
|
|
55
|
-
def
|
47
|
+
def receive_json data
|
56
48
|
data = JSON.load(data)
|
57
49
|
|
58
50
|
unless type = data["type"]
|
@@ -62,13 +54,13 @@ module FFWD::Plugin::JsonLine
|
|
62
54
|
|
63
55
|
if type == "metric"
|
64
56
|
@core.input.metric read_metric(data)
|
65
|
-
@bind.increment :
|
57
|
+
@bind.increment :received_metrics
|
66
58
|
return
|
67
59
|
end
|
68
60
|
|
69
61
|
if type == "event"
|
70
62
|
@core.input.event read_event(data)
|
71
|
-
@bind.increment :
|
63
|
+
@bind.increment :received_events
|
72
64
|
return
|
73
65
|
end
|
74
66
|
|
data/lib/ffwd/plugin/log.rb
CHANGED
@@ -25,7 +25,12 @@ module FFWD::Plugin
|
|
25
25
|
include FFWD::Plugin
|
26
26
|
include FFWD::Logging
|
27
27
|
|
28
|
-
register_plugin "log"
|
28
|
+
register_plugin "log",
|
29
|
+
:description => "A simple plugin that outputs to the primary log.",
|
30
|
+
:options => [
|
31
|
+
FFWD::Plugin.option(:prefix, :help => "Prefix for every line logged."),
|
32
|
+
]
|
33
|
+
|
29
34
|
|
30
35
|
def self.setup_output opts, core
|
31
36
|
prefix = opts[:prefix]
|
data/lib/ffwd/processor/count.rb
CHANGED
@@ -54,19 +54,25 @@ module FFWD::Processor
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def flush_caches! now
|
57
|
-
@cache.each do |
|
57
|
+
@cache.each do |cache_key, entry|
|
58
|
+
key = entry[:key]
|
58
59
|
count = entry[:count]
|
59
60
|
last = entry[:last]
|
60
61
|
|
62
|
+
# OK to modify the hash being iterated over.
|
61
63
|
if now - last > @timeout
|
62
|
-
@cache.delete
|
64
|
+
@cache.delete cache_key
|
63
65
|
next
|
64
66
|
end
|
65
67
|
|
68
|
+
attributes = entry[:attributes]
|
69
|
+
tags = entry[:tags]
|
70
|
+
|
66
71
|
entry[:count] = 0
|
67
72
|
|
68
73
|
@emitter.metric.emit(
|
69
|
-
:key =>
|
74
|
+
:key => key, :value => count, :source => key,
|
75
|
+
:attributes => attributes, :tags => tags)
|
70
76
|
end
|
71
77
|
end
|
72
78
|
|
@@ -77,7 +83,7 @@ module FFWD::Processor
|
|
77
83
|
|
78
84
|
@timer = EM::Timer.new(@period) do
|
79
85
|
@timer = nil
|
80
|
-
digest!
|
86
|
+
digest! Time.now
|
81
87
|
end
|
82
88
|
end
|
83
89
|
|
@@ -95,9 +101,14 @@ module FFWD::Processor
|
|
95
101
|
|
96
102
|
now = Time.now
|
97
103
|
|
98
|
-
|
104
|
+
cache_key = [key, (m[:attributes] || {})].hash
|
105
|
+
|
106
|
+
unless (entry = @cache[cache_key])
|
99
107
|
return increment :dropped if @cache.size >= @cache_limit
|
100
|
-
entry = @cache[
|
108
|
+
entry = @cache[cache_key] = {
|
109
|
+
:key => key,
|
110
|
+
:count => 0, :last => now, :tags => m[:tags],
|
111
|
+
:attributes => m[:attributes]}
|
101
112
|
end
|
102
113
|
|
103
114
|
increment :received
|
data/lib/ffwd/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffwd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- John-John Tedro
|
@@ -9,62 +10,70 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2014-02
|
13
|
+
date: 2014-03-02 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: eventmachine
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
17
19
|
requirements:
|
18
|
-
- - '>='
|
20
|
+
- - ! '>='
|
19
21
|
- !ruby/object:Gem::Version
|
20
22
|
version: '0'
|
21
23
|
type: :runtime
|
22
24
|
prerelease: false
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
24
27
|
requirements:
|
25
|
-
- - '>='
|
28
|
+
- - ! '>='
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: '0'
|
28
31
|
- !ruby/object:Gem::Dependency
|
29
32
|
name: rspec
|
30
33
|
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
31
35
|
requirements:
|
32
|
-
- - '>='
|
36
|
+
- - ! '>='
|
33
37
|
- !ruby/object:Gem::Version
|
34
38
|
version: '0'
|
35
39
|
type: :development
|
36
40
|
prerelease: false
|
37
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
38
43
|
requirements:
|
39
|
-
- - '>='
|
44
|
+
- - ! '>='
|
40
45
|
- !ruby/object:Gem::Version
|
41
46
|
version: '0'
|
42
47
|
- !ruby/object:Gem::Dependency
|
43
48
|
name: rspec-mocks
|
44
49
|
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
45
51
|
requirements:
|
46
|
-
- - '>='
|
52
|
+
- - ! '>='
|
47
53
|
- !ruby/object:Gem::Version
|
48
54
|
version: '0'
|
49
55
|
type: :development
|
50
56
|
prerelease: false
|
51
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
52
59
|
requirements:
|
53
|
-
- - '>='
|
60
|
+
- - ! '>='
|
54
61
|
- !ruby/object:Gem::Version
|
55
62
|
version: '0'
|
56
63
|
- !ruby/object:Gem::Dependency
|
57
64
|
name: autoversion
|
58
65
|
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
59
67
|
requirements:
|
60
|
-
- - '>='
|
68
|
+
- - ! '>='
|
61
69
|
- !ruby/object:Gem::Version
|
62
70
|
version: '0'
|
63
71
|
type: :development
|
64
72
|
prerelease: false
|
65
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
66
75
|
requirements:
|
67
|
-
- - '>='
|
76
|
+
- - ! '>='
|
68
77
|
- !ruby/object:Gem::Version
|
69
78
|
version: '0'
|
70
79
|
description:
|
@@ -77,87 +86,88 @@ executables:
|
|
77
86
|
extensions: []
|
78
87
|
extra_rdoc_files: []
|
79
88
|
files:
|
80
|
-
- bin/fwc
|
81
89
|
- bin/ffwd
|
82
|
-
-
|
83
|
-
- lib/ffwd.rb
|
84
|
-
- lib/ffwd/statistics.rb
|
85
|
-
- lib/ffwd/processor.rb
|
90
|
+
- bin/fwc
|
86
91
|
- lib/ffwd/producing_client.rb
|
87
|
-
- lib/ffwd/tunnel.rb
|
88
|
-
- lib/ffwd/
|
92
|
+
- lib/ffwd/tunnel/udp.rb
|
93
|
+
- lib/ffwd/tunnel/plugin.rb
|
94
|
+
- lib/ffwd/tunnel/tcp.rb
|
89
95
|
- lib/ffwd/lifecycle.rb
|
90
|
-
- lib/ffwd/
|
91
|
-
- lib/ffwd/
|
92
|
-
- lib/ffwd/
|
93
|
-
- lib/ffwd/
|
94
|
-
- lib/ffwd/plugin/json_line/connection.rb
|
95
|
-
- lib/ffwd/plugin/log/writer.rb
|
96
|
-
- lib/ffwd/plugin/log.rb
|
97
|
-
- lib/ffwd/plugin/json_line.rb
|
98
|
-
- lib/ffwd/circular_buffer.rb
|
99
|
-
- lib/ffwd/event.rb
|
100
|
-
- lib/ffwd/statistics/system_statistics.rb
|
96
|
+
- lib/ffwd/logging.rb
|
97
|
+
- lib/ffwd/metric.rb
|
98
|
+
- lib/ffwd/schema.rb
|
99
|
+
- lib/ffwd/version.rb
|
101
100
|
- lib/ffwd/statistics/collector.rb
|
102
|
-
- lib/ffwd/
|
101
|
+
- lib/ffwd/statistics/system_statistics.rb
|
103
102
|
- lib/ffwd/utils.rb
|
104
|
-
- lib/ffwd/protocol/
|
103
|
+
- lib/ffwd/protocol/udp.rb
|
105
104
|
- lib/ffwd/protocol/tcp/bind.rb
|
106
|
-
- lib/ffwd/protocol/tcp/plain_connect.rb
|
107
105
|
- lib/ffwd/protocol/tcp/flushing_connect.rb
|
106
|
+
- lib/ffwd/protocol/tcp/plain_connect.rb
|
108
107
|
- lib/ffwd/protocol/tcp/connection.rb
|
108
|
+
- lib/ffwd/protocol/tcp.rb
|
109
109
|
- lib/ffwd/protocol/udp/bind.rb
|
110
110
|
- lib/ffwd/protocol/udp/connect.rb
|
111
|
-
- lib/ffwd/
|
112
|
-
- lib/ffwd/
|
113
|
-
- lib/ffwd/
|
114
|
-
- lib/ffwd/
|
115
|
-
- lib/ffwd/
|
116
|
-
- lib/ffwd/
|
117
|
-
- lib/ffwd/
|
118
|
-
- lib/ffwd/
|
119
|
-
- lib/ffwd/
|
111
|
+
- lib/ffwd/plugin/log/writer.rb
|
112
|
+
- lib/ffwd/plugin/log.rb
|
113
|
+
- lib/ffwd/plugin/json.rb
|
114
|
+
- lib/ffwd/plugin/json/connection.rb
|
115
|
+
- lib/ffwd/handler.rb
|
116
|
+
- lib/ffwd/protocol.rb
|
117
|
+
- lib/ffwd/plugin.rb
|
118
|
+
- lib/ffwd/debug.rb
|
119
|
+
- lib/ffwd/event.rb
|
120
|
+
- lib/ffwd/processor.rb
|
121
|
+
- lib/ffwd/debug/monitor_session.rb
|
122
|
+
- lib/ffwd/debug/tcp.rb
|
123
|
+
- lib/ffwd/debug/connection.rb
|
124
|
+
- lib/ffwd/channel.rb
|
125
|
+
- lib/ffwd/circular_buffer.rb
|
120
126
|
- lib/ffwd/core/interface.rb
|
121
|
-
- lib/ffwd/core/reporter.rb
|
122
127
|
- lib/ffwd/core/emitter.rb
|
123
|
-
- lib/ffwd/
|
124
|
-
- lib/ffwd/
|
128
|
+
- lib/ffwd/core/processor.rb
|
129
|
+
- lib/ffwd/core/reporter.rb
|
125
130
|
- lib/ffwd/core.rb
|
126
|
-
- lib/ffwd/
|
131
|
+
- lib/ffwd/plugin_channel.rb
|
132
|
+
- lib/ffwd/plugin_loader.rb
|
133
|
+
- lib/ffwd/reporter.rb
|
134
|
+
- lib/ffwd/metric_emitter.rb
|
135
|
+
- lib/ffwd/statistics.rb
|
136
|
+
- lib/ffwd/schema/spotify100.rb
|
137
|
+
- lib/ffwd/schema/default.rb
|
138
|
+
- lib/ffwd/retrier.rb
|
139
|
+
- lib/ffwd/tunnel.rb
|
127
140
|
- lib/ffwd/processor/count.rb
|
128
141
|
- lib/ffwd/processor/histogram.rb
|
129
|
-
- lib/ffwd/
|
130
|
-
- lib/ffwd/
|
131
|
-
- lib/ffwd/
|
132
|
-
- lib/ffwd
|
133
|
-
- lib/ffwd/tunnel/tcp.rb
|
134
|
-
- lib/ffwd/tunnel/udp.rb
|
135
|
-
- lib/ffwd/tunnel/plugin.rb
|
136
|
-
- lib/ffwd/plugin.rb
|
137
|
-
- lib/ffwd/metric.rb
|
142
|
+
- lib/ffwd/processor/rate.rb
|
143
|
+
- lib/ffwd/event_emitter.rb
|
144
|
+
- lib/ffwd/connection.rb
|
145
|
+
- lib/ffwd.rb
|
138
146
|
- lib/em/all.rb
|
147
|
+
- lib/fwc.rb
|
139
148
|
homepage: https://github.com/spotify/ffwd
|
140
149
|
licenses:
|
141
150
|
- Apache 2.0
|
142
|
-
metadata: {}
|
143
151
|
post_install_message:
|
144
152
|
rdoc_options: []
|
145
153
|
require_paths:
|
146
154
|
- lib
|
147
155
|
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
148
157
|
requirements:
|
149
|
-
- - '>='
|
158
|
+
- - ! '>='
|
150
159
|
- !ruby/object:Gem::Version
|
151
160
|
version: '0'
|
152
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
153
163
|
requirements:
|
154
|
-
- - '>='
|
164
|
+
- - ! '>='
|
155
165
|
- !ruby/object:Gem::Version
|
156
166
|
version: '0'
|
157
167
|
requirements: []
|
158
168
|
rubyforge_project:
|
159
|
-
rubygems_version:
|
169
|
+
rubygems_version: 1.8.23
|
160
170
|
signing_key:
|
161
|
-
specification_version:
|
171
|
+
specification_version: 3
|
162
172
|
summary: Core framework for the FastForward Daemon.
|
163
173
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 1d0b671545d89979b849e559f5a5e5c6c0a86d8a
|
4
|
-
data.tar.gz: 3470a5c756d427bac159f4ea1c2c5a45099f87ef
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 84bfcbee1c667878c8760b3c1722c8d3b3a822d8d1f23d4c0e25e0bde744d815c4d74f7d3f6baf4a52be058b2d8c18a5506117f51e29e8e7e6c0236dd3b2ab11
|
7
|
-
data.tar.gz: 0e97592bd405068ae86f0d6057cc9d8d0989b310858b7e070a53dfc0c583c71de538edf12086c60658f768191423f2be5b02d38ff4ec98cf5ca078fcdfd20ef1
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# $LICENSE
|
2
|
-
# Copyright 2013-2014 Spotify AB. All rights reserved.
|
3
|
-
#
|
4
|
-
# The contents of this file are licensed under the Apache License, Version 2.0
|
5
|
-
# (the "License"); you may not use this file except in compliance with the
|
6
|
-
# License. You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
-
# License for the specific language governing permissions and limitations under
|
14
|
-
# the License.
|
15
|
-
|
16
|
-
require 'eventmachine'
|
17
|
-
|
18
|
-
require 'ffwd/protocol'
|
19
|
-
require 'ffwd/plugin'
|
20
|
-
require 'ffwd/logging'
|
21
|
-
|
22
|
-
require_relative 'json_line/connection'
|
23
|
-
|
24
|
-
module FFWD::Plugin::JsonLine
|
25
|
-
include FFWD::Plugin
|
26
|
-
include FFWD::Logging
|
27
|
-
|
28
|
-
register_plugin "json_line"
|
29
|
-
|
30
|
-
DEFAULT_HOST = "localhost"
|
31
|
-
DEFAULT_PORT = 19000
|
32
|
-
|
33
|
-
def self.setup_input opts, core
|
34
|
-
opts[:host] ||= DEFAULT_HOST
|
35
|
-
opts[:port] ||= DEFAULT_PORT
|
36
|
-
buffer_limit = opts["buffer_limit"] || 1000
|
37
|
-
protocol = FFWD.parse_protocol(opts[:protocol] || "tcp")
|
38
|
-
protocol.bind opts, core, log, Connection, buffer_limit
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.setup_tunnel opts, core, tunnel
|
42
|
-
opts[:port] ||= DEFAULT_PORT
|
43
|
-
buffer_limit = opts["buffer_limit"] || 1000
|
44
|
-
protocol = FFWD.parse_protocol(opts[:protocol] || "tcp")
|
45
|
-
protocol.tunnel opts, core, tunnel, log, Connection, buffer_limit
|
46
|
-
end
|
47
|
-
end
|