right_support 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -97,13 +97,15 @@ module RightSupport::Rack
97
97
  sess = ""
98
98
  end
99
99
 
100
+ shard_info = 'Shard: ' + (env['HTTP_X_SHARD'] || 'default').to_s + ';'
101
+
100
102
  params = [
101
103
  env["REQUEST_METHOD"],
102
104
  env["PATH_INFO"],
103
105
  query_info,
104
106
  remote_addr,
105
107
  sess,
106
- 'Shard_id:' + (env['HTTP_X_SHARD'] || 'not set').to_s + ';',
108
+ shard_info,
107
109
  env["rack.request_uuid"] || ''
108
110
  ]
109
111
 
@@ -220,8 +220,8 @@ module RightSupport
220
220
  #
221
221
  # === Parameters
222
222
  # stats(Hash):: Statistics with generic keys "name", "identity", "hostname", "revision", "service uptime",
223
- # "machine uptime", "memory KB", "stat time", "last reset time", "version", and "broker" with
224
- # the latter two and "revision", "machine uptime", "memory KB", "version", and "broker" being optional;
223
+ # "machine uptime", "memory KB", "stat time", "last reset time", "version", and "brokers" with
224
+ # "revision", "machine uptime", "memory KB", "version", and "brokers" being optional;
225
225
  # any other keys ending with "stats" have an associated hash value that is displayed in sorted
226
226
  # key order, unless "stats" is preceded by a non-blank, in which case that character is prepended
227
227
  # to the key to drive the sort order
@@ -243,7 +243,7 @@ module RightSupport
243
243
  end
244
244
  str += sprintf("%-#{name_width}s#{SEPARATOR}%s\n", "stat time", time_at(stats["stat time"], with_year = true)) +
245
245
  sprintf("%-#{name_width}s#{SEPARATOR}%s\n", "last reset", time_at(stats["last reset time"], with_year = true)) +
246
- sprintf("%-#{name_width}s#{SEPARATOR}%s\n", "service up", elapsed(stats["service uptime"]))
246
+ sprintf("%-#{name_width}s#{SEPARATOR}%s\n", "service up", service_up_str(stats["service uptime"]))
247
247
  if stats.has_key?("machine uptime")
248
248
  str += sprintf("%-#{name_width}s#{SEPARATOR}%s\n", "machine up", elapsed(stats["machine uptime"]))
249
249
  end
@@ -262,6 +262,30 @@ module RightSupport
262
262
  str
263
263
  end
264
264
 
265
+ # Converts service uptime stats to displayable format
266
+ #
267
+ # === Parameters
268
+ # stats(Integer|Hash):: Service uptime in seconds if an Integer, otherwise a Hash containing
269
+ # "uptime", "total_uptime", "restarts", "graceful_exits", "crashes", and "last_crash_time" values
270
+ #
271
+ # === Return
272
+ # (String):: Service uptime display
273
+ def self.service_up_str(stats)
274
+ if stats.is_a?(Integer)
275
+ elapsed(stats)
276
+ else
277
+ str = elapsed(stats["uptime"])
278
+ if (r = stats["restarts"]) && r > 0
279
+ non_graceful = (n = r - stats["graceful_exits"]) > 0 ? "#{n} non-graceful, " : ""
280
+ str += ", restarts: #{r} (#{non_graceful}up #{elapsed(stats["total_uptime"])} total)"
281
+ end
282
+ if (c = stats["crashes"]) && c > 0
283
+ str += ", crashes: #{c} (last #{elapsed(Time.now.to_i - stats["last_crash_time"])} ago)"
284
+ end
285
+ str
286
+ end
287
+ end
288
+
265
289
  # Convert broker information to displayable format
266
290
  #
267
291
  # === Parameter
@@ -7,8 +7,8 @@ spec = Gem::Specification.new do |s|
7
7
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
8
8
 
9
9
  s.name = 'right_support'
10
- s.version = '2.4.0'
11
- s.date = '2012-09-17'
10
+ s.version = '2.4.1'
11
+ s.date = '2012-09-18'
12
12
 
13
13
  s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff', 'Sergey Enin']
14
14
  s.email = 'support@rightscale.com'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_support
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 4
9
- - 0
10
- version: 2.4.0
9
+ - 1
10
+ version: 2.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tony Spataro
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2012-09-17 00:00:00 -07:00
22
+ date: 2012-09-18 00:00:00 -07:00
23
23
  default_executable:
24
24
  dependencies: []
25
25