whacamole 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,12 +50,23 @@ module Whacamole
50
50
 
51
51
  def memory_size_from_chunk(chunk)
52
52
  sizes = []
53
+
54
+ # new log format
53
55
  chunk.split("\n").select{|line| line.include? "sample#memory_total"}.each do |line|
54
56
  dyno = line.match(/web\.\d+/)
55
57
  next unless dyno
56
58
  size = line.match(/sample#memory_total=([\d\.]+)/)
57
59
  sizes << [dyno[0], size[1]]
58
60
  end
61
+
62
+ # old log format
63
+ chunk.split("\n").select{|line| line.include? "measure=memory_total"}.each do |line|
64
+ dyno = line.match(/web\.\d+/)
65
+ next unless dyno
66
+ size = line.match(/val=([\d\.]+)/)
67
+ sizes << [dyno[0], size[1]]
68
+ end
69
+
59
70
  sizes
60
71
  end
61
72
 
@@ -1,4 +1,4 @@
1
1
  module Whacamole
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
4
4
 
@@ -37,15 +37,20 @@ describe Whacamole::Stream do
37
37
  context "when memory usage is present" do
38
38
  it "surfaces the memory usage" do
39
39
  stream.dispatch_handlers <<-CHUNK
40
+ ## NEW LOG FORMAT
40
41
  2013-08-22T16:39:22.208103+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=aisle50.com fwd="205.159.94.63" dyno=web.3 connect=1ms service=20ms status=200 bytes=894
41
42
  2013-08-22T16:39:22.224847+00:00 heroku[router]: at=info method=GET path=/ host=www.aisle50.com fwd="119.63.193.132" dyno=web.3 connect=1ms service=5ms status=301 bytes=0
42
43
  2013-08-22T16:39:22.919300+00:00 heroku[web.2]: source=web.2 dyno=heroku.772639.a334caa8-736c-48b3-bac2-d366f75d7fa0 sample#load_avg_1m=0.20 sample#load_avg_5m=0.33 sample#load_avg_15m=0.38
43
44
  2013-08-22T16:39:22.919536+00:00 heroku[web.2]: source=web.2 dyno=heroku.772639.a334caa8-736c-48b3-bac2-d366f75d7fa0 sample#memory_total=581.95MB sample#memory_rss=581.75MB sample#memory_cache=0.16MB sample#memory_swap=0.03MB sample#memory_pgpgin=0pages sample#memory_pgpgout=179329pages
44
45
  2013-08-22T16:39:22.919773+00:00 heroku[web.2]: source=web.2 dyno=heroku.772639.a334caa8-736c-48b3-bac2-d366f75d7fa0 sample#diskmbytes=0MB
45
46
  2013-08-22T16:39:23.045250+00:00 heroku[web.1]: source=web.1 dyno=heroku.772639.4c9dcf54-f339-4d81-9756-8dad47f178a4 sample#load_avg_1m=0.24 sample#load_avg_5m=0.59
46
- 2013-08-22T16:39:23.045521+00:00 heroku[web.90]: source=web.1 dyno=heroku.772639.4c9dcf54-f339-4d81-9756-8dad47f178a4 sample#memory_total=66MB sample#memory_rss=471.21MB sample#memory_cache=0.05MB sample#memory_swap=0.02MB sample#memory_pgpgin=0pages sample#memory_pgpgout=145277pages
47
47
  2013-08-22T16:39:23.045789+00:00 heroku[web.1]: source=web.1 dyno=heroku.772639.4c9dcf54-f339-4d81-9756-8dad47f178a4 sample#diskmbytes=0MB
48
48
  2013-08-22T16:39:23.364649+00:00 heroku[worker.1]: source=worker.1 dyno=heroku.772639.ae391b5d-e776-43f9-b056-360912563d61 sample#load_avg_1m=0.00 sample#load_avg_5m=0.01 sample#load_avg_15m=0.02
49
+
50
+ ## OLD LOG FORMAT
51
+ 2013-08-30T14:39:57.132272+00:00 heroku[web.1]: source=heroku.772639.web.1.50578a75-9052-4e14-ac30-ba3686750017 measure=load_avg_1m val=0.00
52
+ 2013-08-30T14:39:57.132782+00:00 heroku[web.1]: source=heroku.772639.web.1.50578a75-9052-4e14-ac30-ba3686750017 measure=load_avg_15m val=0.20
53
+ 2013-08-30T14:39:57.133012+00:00 heroku[web.1]: source=heroku.772639.web.1.50578a75-9052-4e14-ac30-ba3686750017 measure=memory_total val=509 units=MB
49
54
  CHUNK
50
55
 
51
56
  eh.events.length.should == 2
@@ -56,9 +61,9 @@ describe Whacamole::Stream do
56
61
  eh.events.first.process.should == "web.2"
57
62
 
58
63
  eh.events.last.should be_a Whacamole::Events::DynoSize
59
- eh.events.last.size.should == 66.0
64
+ eh.events.last.size.should == 509
60
65
  eh.events.last.units.should == "MB"
61
- eh.events.last.process.should == "web.90"
66
+ eh.events.last.process.should == "web.1"
62
67
  end
63
68
  end
64
69
 
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.email = "archslide@gmail.com"
10
10
 
11
11
  gem.description = "Whacamole"
12
- gem.summary = ""
12
+ gem.summary = "restart heroku dynos that run out of RAM instead of swapping to disk"
13
13
  gem.homepage = "http://github.com/arches/whacamole"
14
14
  gem.version = Whacamole::VERSION
15
15
  gem.license = 'MIT'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whacamole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-29 00:00:00.000000000Z
12
+ date: 2013-08-30 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -94,7 +94,7 @@ rubyforge_project:
94
94
  rubygems_version: 1.8.19
95
95
  signing_key:
96
96
  specification_version: 3
97
- summary: ''
97
+ summary: restart heroku dynos that run out of RAM instead of swapping to disk
98
98
  test_files:
99
99
  - spec/config_spec.rb
100
100
  - spec/events_spec.rb