process-metrics 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca29ce7e69894dd4f9f766caa5ee6055c1a25c06d1b764960ffe72c15dfb1958
4
- data.tar.gz: 4723276718e25bc09053ba004357f33a720d3da342b384277f07b5a3eebe898e
3
+ metadata.gz: 21b2cec0ce445dbf8e7401a91b2ef3698c2b2d0dc1faa497e6c5e18cbb80efbe
4
+ data.tar.gz: 0d7004039c130aa4c13aafcf3bbe867fbded7a9968bb5cf1f1f64e8e153c518c
5
5
  SHA512:
6
- metadata.gz: b6548743e1120c91c17cf5aa6255bb14991c68ac7b28861325ea3376061e7a3da18f4d1bfc7762f83eb48e46f2e1ce792e1550e3fc16cae13254f5c8189e9650
7
- data.tar.gz: 53cbcbabaef2f8d414e877eeb5b3d1dbc286f87cbb01ce4a6afee588527440e94c9ea144af4e13d5bb7f085971b2da91f373684bbc8076980cafe02c6aa8f7f6
6
+ metadata.gz: a368497ef8239069aadbbbdf507892f516d7109325f5e5363b6c666abf4df2fac788b4406e2f596af2151d67f3cb433a937ca9a55c63ba1289874427a3bb5763
7
+ data.tar.gz: 1022c8a322daf3b779324d8a8ec04daf2014336c80e9feb3f4686eefd0ff918d08b24f1fd4d626fa7df69732fdae93199a320c4769654ac75dbece2ad12c0225
checksums.yaml.gz.sig CHANGED
Binary file
@@ -11,20 +11,16 @@ module Process
11
11
  # @parameter pid [Integer] The process ID.
12
12
  # @parameter usage [Memory] The Memory instance to populate with fault counters.
13
13
  def self.capture_faults(pid, usage)
14
- begin
15
- stat = File.read("/proc/#{pid}/stat")
16
- # The comm field can contain spaces and parentheses; find the closing ')':
17
- rparen_index = stat.rindex(")")
18
- return unless rparen_index
19
- fields = stat[(rparen_index+2)..-1].split(/\s+/)
20
- # proc(5): field 10=minflt, 12=majflt; our fields array is 0-indexed from field 3.
21
- usage.minor_faults = fields[10-3].to_i
22
- usage.major_faults = fields[12-3].to_i
23
- rescue Errno::ENOENT, Errno::EACCES
24
- # The process may have exited or permissions are insufficient; ignore.
25
- rescue => error
26
- # Be robust to unexpected formats; ignore errors silently.
27
- end
14
+ stat = File.read("/proc/#{pid}/stat")
15
+ # The comm field can contain spaces and parentheses; find the closing ')':
16
+ rparen_index = stat.rindex(")")
17
+ return unless rparen_index
18
+ fields = stat[(rparen_index+2)..-1].split(/\s+/)
19
+ # proc(5): field 10=minflt, 12=majflt; our fields array is 0-indexed from field 3.
20
+ usage.minor_faults = fields[10-3].to_i
21
+ usage.major_faults = fields[12-3].to_i
22
+ rescue
23
+ # Be robust to unexpected formats; ignore errors silently.
28
24
  end
29
25
 
30
26
  # @returns [Numeric] Total memory size in kilobytes.
@@ -72,8 +68,8 @@ module Process
72
68
  usage.map_count += File.readlines("/proc/#{pid}/maps").size
73
69
  # Also capture fault counters:
74
70
  self.capture_faults(pid, usage)
75
- rescue Errno::ENOENT => error
76
- # Ignore.
71
+ rescue Errno::ENOENT, Errno::ESRCH
72
+ # Ignore, process may have ended.
77
73
  end
78
74
 
79
75
  return usage
@@ -104,8 +100,8 @@ module Process
104
100
  end
105
101
  # Also capture fault counters:
106
102
  self.capture_faults(pid, usage)
107
- rescue Errno::ENOENT => error
108
- # Ignore.
103
+ rescue Errno::ENOENT, Errno::ESRCH
104
+ # Ignore, process may have ended.
109
105
  end
110
106
 
111
107
  return usage
@@ -7,6 +7,6 @@
7
7
  module Process
8
8
  # @namespace
9
9
  module Metrics
10
- VERSION = "0.6.0"
10
+ VERSION = "0.6.1"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -16,6 +16,10 @@ Please see the [project documentation](https://socketry.github.io/process-metric
16
16
 
17
17
  Please see the [project releases](https://socketry.github.io/process-metrics/releases/index) for all releases.
18
18
 
19
+ ### v0.6.1
20
+
21
+ - Handle `Errno::ESRCH: No such process @ io_fillbuf - fd:xxx /proc/xxx/smaps_rollup` by ignoring it.
22
+
19
23
  ### v0.6.0
20
24
 
21
25
  - Add support for major and minor page faults on Linux: `Process::Metrics::Memory#major_faults` and `#minor_faults`. Unfortunately these metrics are not available on Darwin (macOS).
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.6.1
4
+
5
+ - Handle `Errno::ESRCH: No such process @ io_fillbuf - fd:xxx /proc/xxx/smaps_rollup` by ignoring it.
6
+
3
7
  ## v0.6.0
4
8
 
5
9
  - Add support for major and minor page faults on Linux: `Process::Metrics::Memory#major_faults` and `#minor_faults`. Unfortunately these metrics are not available on Darwin (macOS).
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.7.2
125
+ rubygems_version: 3.6.9
126
126
  specification_version: 4
127
127
  summary: Provide detailed OS-specific process metrics.
128
128
  test_files: []
metadata.gz.sig CHANGED
Binary file