Permalink
Browse files

Fixed load and requests_per_second.

Changes in Capistrano's internals put watch_load and
watch_requests "out of order".
  • Loading branch information...
1 parent f8e7e65 commit b4acfed51b2fc9edd97f997f37c2ca5ee421c9ad @baldowl baldowl committed with jamis Sep 5, 2008
Showing with 7 additions and 5 deletions.
  1. +2 −0 CHANGELOG.rdoc
  2. +5 −5 lib/capistrano/ext/monitor.rb
View
@@ -1,5 +1,7 @@
== (unreleased)
+* Fixed load and requests_per_second to work with cap2 [Gufo Pelato]
+
* Allow tasks in staging files to be invoked without explicitly specifying the stage [Michael Hale]
@@ -57,8 +57,8 @@ def remote_env(value)
# Monitor the load of the servers tied to the current task.
def load(options={})
- servers = current_task.servers.sort
- names = servers.map { |s| s.match(/^([^.]+)/)[1] }
+ servers = find_servers_for_task(current_task).sort
+ names = servers.map { |s| s.host.match(/^([^.]+)/)[1] }
time = date_column(:init)
load_column_width = "0.00".length * 3 + 2
@@ -88,7 +88,7 @@ def load(options={})
header.call if time[:rows] % 40 == 0
print(date_column(:show, time), " ")
- servers.each { |server| print(uptimes[server].join("/"), " ") }
+ servers.each { |server| print(uptimes[server.host].join("/"), " ") }
puts
# sleep this way, so that CTRL-C works immediately
@@ -108,7 +108,7 @@ def requests_per_second(*logs)
# set up the date column formatter, and get the list of servers
time = date_column(:init)
- servers = current_task.servers.sort
+ servers = find_servers_for_task(current_task).sort
# initialize various helper variables we'll be using
mutex = Mutex.new
@@ -156,7 +156,7 @@ def requests_per_second(*logs)
# compute the stuff we need to know for displaying the header
num_len = (num_format % 1).length
column_width = num_len * (servers.length + 1) + servers.length
- abbvs = servers.map { |server| server.match(/^(\w+)/)[1][0,num_len] }
+ abbvs = servers.map { |server| server.host.match(/^(\w+)/)[1][0,num_len] }
col_header = abbvs.map { |v| "%-*s" % [num_len, v] }.join("/")
# write both rows of the header

0 comments on commit b4acfed

Please sign in to comment.