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 +4 -4
- data/lib/ffwd/plugin/riemann/output.rb +42 -7
- data/lib/ffwd/plugin/riemann/shared.rb +1 -1
- data/lib/ffwd/plugin/riemann/version.rb +1 -1
- data/lib/ffwd/plugin/riemann.rb +20 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfd54da83a92c993944beb2e205832e00ae730f6
|
4
|
+
data.tar.gz: 5ddc0cc8042aa417bf0322632fb5bc779bb8a3bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
23
|
-
|
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
|
42
|
+
send_data output_encode(m)
|
27
43
|
end
|
28
44
|
|
29
45
|
def send_event event
|
30
|
-
|
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
|
54
|
+
send_data output_encode(m)
|
33
55
|
end
|
34
56
|
|
35
57
|
def send_metric metric
|
36
|
-
|
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
|
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
|
|
data/lib/ffwd/plugin/riemann.rb
CHANGED
@@ -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
|
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
|
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.
|
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-
|
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.
|
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.
|
40
|
+
version: 0.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|