recognizer 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/recognizer/amqp.rb +9 -13
- data/lib/recognizer/librato.rb +2 -2
- data/lib/recognizer/version.rb +1 -1
- metadata +4 -4
data/lib/recognizer/amqp.rb
CHANGED
@@ -18,19 +18,15 @@ module Recognizer
|
|
18
18
|
puts "Awaiting the metrics with impatience ..."
|
19
19
|
queue.subscribe do |message|
|
20
20
|
payload = message[:payload]
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
rescue JSON::ParserError
|
31
|
-
metric = payload
|
32
|
-
if metric.split(" ").count == 3
|
33
|
-
thread_queue.push(metric)
|
21
|
+
routing_key = message[:routing_key]
|
22
|
+
lines = payload.split("\n")
|
23
|
+
lines.each do |line|
|
24
|
+
line = line.strip
|
25
|
+
case line.split(" ").count
|
26
|
+
when 3
|
27
|
+
thread_queue.push(line)
|
28
|
+
when 2
|
29
|
+
thread_queue.push("#{routing_key} #{line}")
|
34
30
|
end
|
35
31
|
end
|
36
32
|
end
|
data/lib/recognizer/librato.rb
CHANGED
@@ -31,9 +31,9 @@ module Recognizer
|
|
31
31
|
loop do
|
32
32
|
graphite_formated = thread_queue.pop
|
33
33
|
puts "Adding metric to queue: #{graphite_formated}"
|
34
|
-
metric = graphite_formated.split(" ")
|
34
|
+
metric, value, timestamp = graphite_formated.split(" ")
|
35
35
|
mutex.synchronize do
|
36
|
-
librato.add metric
|
36
|
+
librato.add metric.to_sym => {:value => value.to_f, :measure_time => timestamp.to_i}
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/recognizer/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recognizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Porter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-12-
|
18
|
+
date: 2011-12-30 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|