ffwd-riemann 0.3.2 → 0.3.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: 3c2456bb4f5d30e6ea70d0071690e85be7b8a333
4
- data.tar.gz: 77ce37d7d1f29422e697e92c8f16aaab28c6410d
3
+ metadata.gz: dfd54da83a92c993944beb2e205832e00ae730f6
4
+ data.tar.gz: 5ddc0cc8042aa417bf0322632fb5bc779bb8a3bf
5
5
  SHA512:
6
- metadata.gz: 1299fff5191870586ec8138c3fbd8c88d71480b09154c5189d763447672abc71c68dcb0f21e5b814bba0f04f083eb80909580919d6eb0625366f80c86b561333
7
- data.tar.gz: 35b5a8c936ee945b59246f3a44deb697c671b02bed38691f3e99e37ced43f512858949929fa93436b74af2eee722e9327585d60aac7d236a9017f7867cc46413
6
+ metadata.gz: 21b30d06d978bc6d268bd55957c1546433271d47207172edac23f3a105828bd4e48d5e181ec18b380cecfebcf9e5d3ddd00e1aaafdaf508b50e72176fbf0b39a
7
+ data.tar.gz: 7d1e02f9c6cc735160daaa12516226811554f8eb4fca89f0dedc31ddf7cc2764abd7933ae914f567d3ad0c2671bf85ea7322745a7c024e0f4d9535896d45120f
@@ -19,23 +19,51 @@ module FFWD::Plugin::Riemann
19
19
  module Output
20
20
  def send_all events, metrics
21
21
  all_events = []
22
- all_events += events.map{|e| make_event e} unless events.empty?
23
- all_events += metrics.map{|m| make_metric m} unless metrics.empty?
22
+
23
+ events.each do |event|
24
+ begin
25
+ all_events << make_event(event)
26
+ rescue => error
27
+ output_failed_event event, error
28
+ end
29
+ end
30
+
31
+ metrics.each do |metric|
32
+ begin
33
+ all_events << make_metric(metric)
34
+ rescue => error
35
+ output_failed_metric metric, error
36
+ end
37
+ end
38
+
24
39
  return if all_events.empty?
40
+
25
41
  m = make_message :events => all_events
26
- send_data encode(m)
42
+ send_data output_encode(m)
27
43
  end
28
44
 
29
45
  def send_event event
30
- e = make_event event
46
+ begin
47
+ e = make_event event
48
+ rescue => error
49
+ output_failed_event event, error
50
+ return
51
+ end
52
+
31
53
  m = make_message :events => [e]
32
- send_data encode(m)
54
+ send_data output_encode(m)
33
55
  end
34
56
 
35
57
  def send_metric metric
36
- e = make_metric metric
58
+ begin
59
+ e = make_metric metric
60
+ rescue => error
61
+ output_failed_metric event, error
62
+ return
63
+ end
64
+
37
65
  m = make_message :events => [e]
38
- send_data encode(m)
66
+ send_data output_encode(m)
39
67
  end
40
68
 
41
69
  def receive_data data
@@ -43,6 +71,13 @@ module FFWD::Plugin::Riemann
43
71
  return if message.ok
44
72
  @bad_acks = (@bad_acks || 0) + 1
45
73
  end
74
+
75
+ def output_encode message
76
+ raise "#output_encode: not implemented"
77
+ end
78
+
79
+ def output_failed_event event, error; end
80
+ def output_failed_metric metric, error; end
46
81
  end
47
82
  end
48
83
 
@@ -54,7 +54,7 @@ module FFWD::Plugin::Riemann
54
54
 
55
55
  e.attributes = source.map{|k, v|
56
56
  k = k.to_s.dup unless k.nil?
57
- v = v.dup unless v.nil?
57
+ v = v.to_s.dup unless v.nil?
58
58
  ::Riemann::Attribute.new(:key => k, :value => v)
59
59
  }
60
60
  end
@@ -16,7 +16,7 @@
16
16
  module FFWD
17
17
  module Plugin
18
18
  module Riemann
19
- VERSION = "0.3.2"
19
+ VERSION = "0.3.3"
20
20
  end
21
21
  end
22
22
  end
@@ -39,6 +39,7 @@ module FFWD::Plugin::Riemann
39
39
  register_plugin "riemann"
40
40
 
41
41
  class OutputTCP < FFWD::Handler
42
+ include FFWD::Logging
42
43
  include FFWD::Plugin::Riemann::Shared
43
44
  include FFWD::Plugin::Riemann::Output
44
45
 
@@ -46,12 +47,21 @@ module FFWD::Plugin::Riemann
46
47
  "riemann"
47
48
  end
48
49
 
49
- def encode m
50
+ def output_encode m
50
51
  m.encode_with_length
51
52
  end
53
+
54
+ def output_failed_event event, error
55
+ log.error "Failed to send event #{event.inspect}: #{error}", error
56
+ end
57
+
58
+ def output_failed_metric metric, error
59
+ log.error "Failed to send metric #{metric.inspect}: #{error}", error
60
+ end
52
61
  end
53
62
 
54
63
  class OutputUDP < FFWD::Handler
64
+ include FFWD::Logging
55
65
  include FFWD::Plugin::Riemann::Shared
56
66
  include FFWD::Plugin::Riemann::Output
57
67
 
@@ -59,9 +69,17 @@ module FFWD::Plugin::Riemann
59
69
  "riemann"
60
70
  end
61
71
 
62
- def encode m
72
+ def output_encode m
63
73
  m.encode
64
74
  end
75
+
76
+ def output_failed_event event, error
77
+ log.error "Failed to send event #{event.inspect}: #{error}", error
78
+ end
79
+
80
+ def output_failed_metric metric, error
81
+ log.error "Failed to send metric #{metric.inspect}: #{error}", error
82
+ end
65
83
  end
66
84
 
67
85
  class InputTCP < FFWD::Connection
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffwd-riemann
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John-John Tedro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-28 00:00:00.000000000 Z
11
+ date: 2014-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riemann-client
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.2
33
+ version: 0.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.2
40
+ version: 0.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement