server_metrics 0.0.8.4 → 0.0.8.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.8.5
2
+
3
+ * Mac per-process memory and per-process CPU reports 0s instead of throwing an exception (Mac only)
4
+
1
5
  ## 0.0.8.4
2
6
 
3
7
  * normalize load (last minute, etc) by number of CPUs. This keeps the metrics in sync with Scout's server load plugin.
@@ -90,7 +90,9 @@ class ServerMetrics::Processes
90
90
  }
91
91
  grouped[proc.comm][:count] += 1
92
92
  grouped[proc.comm][:cpu] += proc.recent_cpu_percentage || 0
93
- grouped[proc.comm][:memory] += proc.rss.to_f / 1024.0
93
+ if proc.respond_to?(:rss) # mac doesn't return rss. Mac returns 0 for memory usage
94
+ grouped[proc.comm][:memory] += proc.rss.to_f / 1024.0
95
+ end
94
96
  grouped[proc.comm][:cmdlines] << proc.cmdline if !grouped[proc.comm][:cmdlines].include?(proc.cmdline)
95
97
  end # processes.each
96
98
 
@@ -153,8 +155,9 @@ class ServerMetrics::Processes
153
155
  end
154
156
  def combined_cpu
155
157
  # best thread I've seen on cutime vs utime & cstime vs stime: https://www.ruby-forum.com/topic/93176
156
- # trying the metric that doesn't include the consumption of child processes
157
- utime + stime
158
+ # * cutime and cstime include CPUusage of child processes
159
+ # * utime and stime don't include CPU usage of child processes
160
+ (utime || 0) + (stime || 0) # utime and stime aren't available on mac. Result is %cpu is 0 on mac.
158
161
  end
159
162
  # delegate everything else to ProcTable::Struct
160
163
  def method_missing(sym, *args, &block)
@@ -1,3 +1,3 @@
1
1
  module ServerMetrics
2
- VERSION = "0.0.8.4"
2
+ VERSION = "0.0.8.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.4
4
+ version: 0.0.8.5
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-12-11 00:00:00.000000000 Z
12
+ date: 2013-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sys-proctable
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  segments:
174
174
  - 0
175
- hash: 3571060902029865156
175
+ hash: 1712031912329811387
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  none: false
178
178
  requirements:
@@ -181,10 +181,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  segments:
183
183
  - 0
184
- hash: 3571060902029865156
184
+ hash: 1712031912329811387
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 1.8.25
187
+ rubygems_version: 1.8.23
188
188
  signing_key:
189
189
  specification_version: 3
190
190
  summary: For use with the Scout agent