daikon 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/daikon.gemspec +1 -1
- data/lib/daikon.rb +1 -1
- data/lib/daikon/monitor.rb +6 -4
- data/spec/client_spec.rb +2 -2
- data/spec/monitor_spec.rb +13 -13
- metadata +3 -3
data/daikon.gemspec
CHANGED
data/lib/daikon.rb
CHANGED
data/lib/daikon/monitor.rb
CHANGED
@@ -26,12 +26,14 @@ module Daikon
|
|
26
26
|
|
27
27
|
def parse(line)
|
28
28
|
if line =~ NEW_FORMAT
|
29
|
-
|
30
|
-
line = $2.strip
|
31
|
-
@queue.push({:at => Time.at(*timestamp.split('.').map(&:to_i)), :command => line})
|
29
|
+
push(Float($1), $2)
|
32
30
|
elsif line =~ OLD_SINGLE_FORMAT || line =~ OLD_MORE_FORMAT
|
33
|
-
|
31
|
+
push(Time.now.to_f, line)
|
34
32
|
end
|
35
33
|
end
|
34
|
+
|
35
|
+
def push(at, command)
|
36
|
+
@queue.push({:at => at, :command => command.strip})
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
data/spec/client_spec.rb
CHANGED
@@ -186,8 +186,8 @@ describe Daikon::Client, "rotate monitor" do
|
|
186
186
|
let(:results) { %{1290289048.96581 "info"\n1290289053.568815 "info"} }
|
187
187
|
let(:redis) { stub("redis instance", :info => results) }
|
188
188
|
let(:lines) do
|
189
|
-
[{"at" =>
|
190
|
-
{"at" =>
|
189
|
+
[{"at" => 1290289048.96581, "command" => "info"},
|
190
|
+
{"at" => 1290289053.568815, "command" => "info"}]
|
191
191
|
end
|
192
192
|
|
193
193
|
before do
|
data/spec/monitor_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Daikon::Monitor, "#parse with new format" do
|
|
19
19
|
|
20
20
|
it "parses the log into json" do
|
21
21
|
subject.parse(line)
|
22
|
-
subject.queue.should include({:at =>
|
22
|
+
subject.queue.should include({:at => 1291699658.994073, :command => '"decrby" "fooz" "2000"'})
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -35,9 +35,9 @@ describe Daikon::Monitor, "#parse with multiple inputs" do
|
|
35
35
|
subject.parse("info")
|
36
36
|
|
37
37
|
subject.queue.size.should == 3
|
38
|
-
subject.queue.should include({:at => Time.now, :command => 'INCR foo'})
|
39
|
-
subject.queue.should include({:at => Time.now, :command => 'INCR fooz'})
|
40
|
-
subject.queue.should include({:at => Time.now, :command => 'info'})
|
38
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'INCR foo'})
|
39
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'INCR fooz'})
|
40
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'info'})
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -53,9 +53,9 @@ describe Daikon::Monitor, "#parse with old multi line input" do
|
|
53
53
|
subject.parse("decr foo")
|
54
54
|
|
55
55
|
subject.queue.size.should == 3
|
56
|
-
subject.queue.should include({:at => Time.now, :command => 'incr foo'})
|
57
|
-
subject.queue.should include({:at => Time.now, :command => 'sismember project-13897-global-error-classes 17'})
|
58
|
-
subject.queue.should include({:at => Time.now, :command => 'decr foo'})
|
56
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'incr foo'})
|
57
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'sismember project-13897-global-error-classes 17'})
|
58
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'decr foo'})
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -71,9 +71,9 @@ describe Daikon::Monitor, "#parse with multi line input with numbers" do
|
|
71
71
|
subject.parse("decr foo")
|
72
72
|
|
73
73
|
subject.queue.size.should == 3
|
74
|
-
subject.queue.should include({:at => Time.now, :command => 'incr foo'})
|
75
|
-
subject.queue.should include({:at => Time.now, :command => 'set g:2470920:mrn 9'})
|
76
|
-
subject.queue.should include({:at => Time.now, :command => 'decr foo'})
|
74
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'incr foo'})
|
75
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'set g:2470920:mrn 9'})
|
76
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'decr foo'})
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -89,8 +89,8 @@ describe Daikon::Monitor, "#parse with strings that may to_i to a number" do
|
|
89
89
|
subject.parse("decr foo")
|
90
90
|
|
91
91
|
subject.queue.size.should == 3
|
92
|
-
subject.queue.should include({:at => Time.now, :command => 'incr foo'})
|
93
|
-
subject.queue.should include({:at => Time.now, :command => 'set g:2470920:mrn 9'})
|
94
|
-
subject.queue.should include({:at => Time.now, :command => 'decr foo'})
|
92
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'incr foo'})
|
93
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'set g:2470920:mrn 9'})
|
94
|
+
subject.queue.should include({:at => Time.now.to_f, :command => 'decr foo'})
|
95
95
|
end
|
96
96
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daikon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nick Quaranto
|