raindrops.git  about / heads / tags
real-time stats for preforking Rack servers
blob 354ae397c0d03ba1bd15a6952ed05152759253fc 1081 bytes (raw)
$ git show v0.4.1:lib/raindrops.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
# -*- encoding: binary -*-
class Raindrops

  # Raindrops is currently at version 0.4.1
  VERSION = '0.4.1'

  # Used to represent the number of +active+ and +queued+ sockets for
  # a single listen socket across all threads and processes on a
  # machine.
  #
  # For TCP listeners, only sockets in the TCP_ESTABLISHED state are
  # accounted for.  For Unix domain listeners, only CONNECTING and
  # CONNECTED Unix domain sockets are accounted for.
  #
  # +active+ connections is the number of accept()-ed but not-yet-closed
  # sockets in all threads/processes sharing the given listener.
  #
  # +queued+ connections is the number of un-accept()-ed sockets in the
  # queue of a given listen socket.
  #
  # These stats are currently only available under Linux
  class ListenStats < Struct.new(:active, :queued)

    # the sum of +active+ and +queued+ sockets
    def total
      active + queued
    end
  end

  # TODO: pure Ruby version for single processes
  require 'raindrops_ext'

  autoload :Struct, 'raindrops/struct'
  autoload :Middleware, 'raindrops/middleware'
end

git clone https://yhbt.net/raindrops.git