ffwd-carbon 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f0680495c78baca38bf4eb33934546b20f888202
4
+ data.tar.gz: fd1b1b9b4dff741be23d68304db804d4d5b2e865
5
+ SHA512:
6
+ metadata.gz: e67d02de0feafd6f14dee2c84684f4734cd1a4b0c5270ac8eb141d06f9affcf0295a1c9987f44fb8cc54742cb30fc19db8b7378868cbd386814e1282016c23a6
7
+ data.tar.gz: a5fab61a8d6b1b58ebcde15a039ede5fced7c36399160ad5a1a663e79493f048ee7c424968461fe9a76279122b60f388712815568701bf0d4cffd702da73bf1b
@@ -13,27 +13,19 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
- require 'eventmachine'
17
-
18
- require 'ffwd/logging'
19
16
  require 'ffwd/connection'
20
17
 
21
18
  module FFWD::Plugin
22
19
  module Carbon
23
20
  class Connection < FFWD::Connection
24
- include FFWD::Logging
25
21
  include EM::Protocols::LineText2
26
22
 
27
- def self.plugin_type
28
- "carbon_in"
29
- end
30
-
31
- def initialize bind, core
23
+ def initialize bind, core, config
32
24
  @bind = bind
33
25
  @core = core
34
26
  end
35
27
 
36
- def parse(line)
28
+ def parse line
37
29
  path, value, timestamp = line.split ' ', 3
38
30
  raise "invalid frame" if timestamp.nil?
39
31
 
@@ -45,13 +37,13 @@ module FFWD::Plugin
45
37
  return {:key => path, :value => value, :time => time}
46
38
  end
47
39
 
48
- def receive_line(ln)
49
- metric = parse(ln)
40
+ def receive_line line
41
+ metric = parse line
50
42
  return if metric.nil?
51
43
  @core.input.metric metric
52
44
  @bind.increment :received_metrics
53
45
  rescue => e
54
- log.error "Failed to receive data", e
46
+ @bind.log.error "Failed to receive data", e
55
47
  end
56
48
  end
57
49
  end
@@ -16,7 +16,7 @@
16
16
  module FFWD
17
17
  module Plugin
18
18
  module Carbon
19
- VERSION = "0.1.7"
19
+ VERSION = "0.2.0"
20
20
  end
21
21
  end
22
22
  end
@@ -43,17 +43,31 @@ module FFWD::Plugin
43
43
  ]),
44
44
  ]
45
45
 
46
- def self.setup_input opts, core
47
- opts[:host] ||= DEFAULT_HOST
48
- opts[:port] ||= DEFAULT_PORT
49
- protocol = FFWD.parse_protocol(opts[:protocol] || DEFAULT_PROTOCOL)
50
- protocol.bind opts, core, log, Connection
46
+ class InputTCP < FFWD::Plugin::Carbon::Connection
47
+ def self.plugin_type
48
+ "carbon_tcp_in"
49
+ end
51
50
  end
52
51
 
53
- def self.setup_tunnel opts, core, tunnel
54
- opts[:port] ||= DEFAULT_PORT
55
- protocol = FFWD.parse_protocol(opts[:protocol] || DEFAULT_PROTOCOL)
56
- protocol.tunnel opts, core, tunnel, log, Connection
52
+ class InputUDP < FFWD::Plugin::Carbon::Connection
53
+ def self.plugin_type
54
+ "carbon_udp_in"
55
+ end
56
+ end
57
+
58
+ INPUTS = {:tcp => InputTCP, :udp => InputUDP}
59
+
60
+ def self.setup_input config
61
+ config[:host] ||= DEFAULT_HOST
62
+ config[:port] ||= DEFAULT_PORT
63
+ config[:protocol] ||= DEFAULT_PROTOCOL
64
+ protocol = FFWD.parse_protocol config[:protocol]
65
+
66
+ unless connection = INPUTS[protocol.family]
67
+ raise "Not supported protocol: #{protocol}"
68
+ end
69
+
70
+ protocol.bind config, log, connection
57
71
  end
58
72
  end
59
73
  end
metadata CHANGED
@@ -1,32 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffwd-carbon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Martin Parm
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-05-30 00:00:00.000000000 Z
11
+ date: 2014-06-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: ffwd
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
21
- version: 0.1.7
19
+ version: 0.2.0
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
29
- version: 0.1.7
26
+ version: 0.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-mocks
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
30
55
  description:
31
56
  email:
32
57
  - parmus@spotify.com
@@ -34,32 +59,31 @@ executables: []
34
59
  extensions: []
35
60
  extra_rdoc_files: []
36
61
  files:
37
- - lib/ffwd/plugin/carbon.rb
38
- - lib/ffwd/plugin/carbon/version.rb
39
62
  - lib/ffwd/plugin/carbon/connection.rb
63
+ - lib/ffwd/plugin/carbon/version.rb
64
+ - lib/ffwd/plugin/carbon.rb
40
65
  homepage: https://github.com/spotify/ffwd
41
66
  licenses:
42
67
  - Apache 2.0
68
+ metadata: {}
43
69
  post_install_message:
44
70
  rdoc_options: []
45
71
  require_paths:
46
72
  - lib
47
73
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
74
  requirements:
50
- - - ! '>='
75
+ - - '>='
51
76
  - !ruby/object:Gem::Version
52
77
  version: '0'
53
78
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
79
  requirements:
56
- - - ! '>='
80
+ - - '>='
57
81
  - !ruby/object:Gem::Version
58
82
  version: '0'
59
83
  requirements: []
60
84
  rubyforge_project:
61
- rubygems_version: 1.8.23
85
+ rubygems_version: 2.0.3
62
86
  signing_key:
63
- specification_version: 3
87
+ specification_version: 4
64
88
  summary: Carbon support for FFWD.
65
89
  test_files: []