daikon 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{daikon}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nick Quaranto"]
@@ -26,5 +26,5 @@ require 'daikon/monitor'
26
26
  require 'daikon/redis_hacks'
27
27
 
28
28
  module Daikon
29
- VERSION = "0.5.0"
29
+ VERSION = "0.5.1"
30
30
  end
@@ -26,12 +26,14 @@ module Daikon
26
26
 
27
27
  def parse(line)
28
28
  if line =~ NEW_FORMAT
29
- timestamp = $1
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
- @queue.push({:at => Time.now, :command => line.strip})
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
@@ -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" => Time.at(1290289048, 96581), "command" => "info"},
190
- {"at" => Time.at(1290289053, 568815), "command" => "info"}]
189
+ [{"at" => 1290289048.96581, "command" => "info"},
190
+ {"at" => 1290289053.568815, "command" => "info"}]
191
191
  end
192
192
 
193
193
  before do
@@ -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 => Time.at(1291699658, 994073), :command => '"decrby" "fooz" "2000"'})
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: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nick Quaranto