io-metrics 0.2.0 → 0.2.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: d3e42882ce221e2e9f10808ed4de4ea6a72b3490662a014727e40b49fe8826ab
4
- data.tar.gz: da5595f41dfe59f91dc3355ebe6538bac4ca0bc70e1c1040c6cc6e911c977498
3
+ metadata.gz: 50d4b28faec3b5ae9389c3437d1e5687c1e54229d0abfd79305699e3f43e798b
4
+ data.tar.gz: 33db46c67476acedd0ee7695d437679ffe8e3602f60de2d15363e9b59423aab6
5
5
  SHA512:
6
- metadata.gz: cee9a635c1df4b7bfc18497e835add923739f5656737126bdc86cae1bca17a8074925243240eed1b802f741e8956d63b18c434af7f8d29853e3750aa3f55b5f7
7
- data.tar.gz: 512a4e960252f726b0a50348d7ceab9f6bbc13247aab649f17a48d9d3d1b58cf489141b9095b24cebabd0d39546196a5bf454e3e8f51389b652b485e16218a6b
6
+ metadata.gz: 4131cbf7a3d8d15256972f057c24608ac1f9a72e958a6361ef24e36ceb97f669767e80dfc309d9c39df6d8aa530d10f82d93d9e53a61f7e6d2b1a47e16568434
7
+ data.tar.gz: b3c5ae946df3a0f7d1fe59d787f91aa0faf95c2f8b8353a2b132576325f033c3e7819613923b5ba79fe87e153424591fa66f3f1cfbc6030592bfa2d44e39619d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -193,8 +193,9 @@ class IO
193
193
  next if address_filter && !address_filter.include?(local_address.downcase)
194
194
 
195
195
  listeners[local_address] ||= Listener.new(Addrinfo.tcp(local_ip, local_port), 0, 0)
196
- # rx_queue shows number of connections waiting to be accepted
197
- listeners[local_address].queue_size = rx_queue_hex.to_i(16)
196
+ # rx_queue shows number of connections waiting to be accepted.
197
+ # Accumulate across SO_REUSEPORT sockets sharing the same address.
198
+ listeners[local_address].queue_size += rx_queue_hex.to_i(16)
198
199
  listeners[local_address].active_connections = 0
199
200
  # Collect ESTABLISHED connections to count later
200
201
  elsif state == :established
@@ -218,6 +219,14 @@ class IO
218
219
  end
219
220
  end
220
221
 
222
+ # /proc lists every ESTABLISHED child with the listener's local address, including
223
+ # sockets still in the accept queue. Those are already counted in queue_size on the
224
+ # LISTEN row (same meaning as Raindrops inet_diag queued vs inode != 0 for active).
225
+ listeners.each_value do |listener|
226
+ backlog = listener.queue_size
227
+ listener.active_connections = [listener.active_connections - backlog, 0].max
228
+ end
229
+
221
230
  return listeners
222
231
  rescue Errno::ENOENT, Errno::EACCES
223
232
  return {}
@@ -7,6 +7,6 @@
7
7
  class IO
8
8
  # @namespace
9
9
  module Metrics
10
- VERSION = "0.2.0"
10
+ VERSION = "0.2.1"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -14,6 +14,11 @@ Please see the [project documentation](https://socketry.github.io/io-metrics/) f
14
14
 
15
15
  Please see the [project releases](https://socketry.github.io/io-metrics/releases/index) for all releases.
16
16
 
17
+ ### v0.2.1
18
+
19
+ - Fixed `queue_size` under-reporting when multiple `SO_REUSEPORT` sockets share the same address — queue depths are now accumulated across all sockets rather than overwritten by the last one.
20
+ - **Linux** `Listener#active_connections` for TCP no longer counts sockets that are still in the kernel accept queue (those remain in `queue_size`). Counts now match the usual “past `accept()`” meaning and align with tools such as Raindrops’ `ListenStats#active`.
21
+
17
22
  ### v0.2.0
18
23
 
19
24
  - **Breaking** `IO::Metrics::Listener.capture` returns an `Array` of `Listener` rows instead of a `Hash` keyed by address string.
data/releases.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Releases
2
2
 
3
+ ## v0.2.1
4
+
5
+ - Fixed `queue_size` under-reporting when multiple `SO_REUSEPORT` sockets share the same address — queue depths are now accumulated across all sockets rather than overwritten by the last one.
6
+ - **Linux** `Listener#active_connections` for TCP no longer counts sockets that are still in the kernel accept queue (those remain in `queue_size`). Counts now match the usual “past `accept()`” meaning and align with tools such as Raindrops’ `ListenStats#active`.
7
+
3
8
  ## v0.2.0
4
9
 
5
10
  - **Breaking** `IO::Metrics::Listener.capture` returns an `Array` of `Listener` rows instead of a `Hash` keyed by address string.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file