recognizer 0.0.4 → 0.0.6
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/librato.rb +13 -4
- data/lib/recognizer/patches/float.rb +5 -0
- data/lib/recognizer/version.rb +1 -1
- data/recognizer.gemspec +1 -1
- metadata +5 -4
data/lib/recognizer/librato.rb
CHANGED
@@ -2,6 +2,8 @@ require "rubygems"
|
|
2
2
|
require "thread"
|
3
3
|
require "librato/metrics"
|
4
4
|
|
5
|
+
require File.join(File.dirname(__FILE__), 'patches', 'float')
|
6
|
+
|
5
7
|
module Recognizer
|
6
8
|
class Librato
|
7
9
|
def initialize(thread_queue, options)
|
@@ -30,10 +32,17 @@ module Recognizer
|
|
30
32
|
Thread.new do
|
31
33
|
loop do
|
32
34
|
graphite_formated = thread_queue.pop
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
begin
|
36
|
+
metric, value, timestamp = graphite_formated.split(" ").inject([]) do |result, part|
|
37
|
+
result << (result.empty? ? part.to_sym : Float(part).pretty)
|
38
|
+
result
|
39
|
+
end
|
40
|
+
puts "Adding metric to queue: #{graphite_formated}"
|
41
|
+
mutex.synchronize do
|
42
|
+
librato.add(metric => {:value => value, :measure_time => timestamp})
|
43
|
+
end
|
44
|
+
rescue ArgumentError
|
45
|
+
puts "Invalid metric: #{graphite_formated}"
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
data/lib/recognizer/version.rb
CHANGED
data/recognizer.gemspec
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: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
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: 2012-01-
|
18
|
+
date: 2012-01-10 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/recognizer/cli.rb
|
96
96
|
- lib/recognizer/config.rb
|
97
97
|
- lib/recognizer/librato.rb
|
98
|
+
- lib/recognizer/patches/float.rb
|
98
99
|
- lib/recognizer/patches/hash.rb
|
99
100
|
- lib/recognizer/version.rb
|
100
101
|
- lib/recognizer.rb
|