raindrops 0.16.0 → 0.17.0
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 +4 -4
- data/.olddoc.yml +10 -4
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +1 -1
- data/LICENSE +3 -3
- data/README +5 -11
- data/examples/watcher_demo.ru +1 -1
- data/examples/yahns.conf.rb +30 -0
- data/examples/zbatery.conf.rb +4 -1
- data/ext/raindrops/linux_inet_diag.c +4 -0
- data/ext/raindrops/linux_tcp_info.c +1 -1
- data/lib/raindrops/aggregate.rb +1 -1
- data/lib/raindrops/middleware.rb +2 -2
- data/lib/raindrops/watcher.rb +13 -13
- data/raindrops.gemspec +1 -1
- metadata +13 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b07afc95a2e2b6d5f116be36ceab5bfe45b58bef
|
|
4
|
+
data.tar.gz: 5c8e436802a87b95de68fda59b5e0947d58a4ad5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd1415d86ff4e2a641eec851906498b551318d0a66cdc52d8cfafe5d46826ede496c0e44b9b6a768ea95db0537f03b5387ce4fda09a8e97af2a8f9ab7ce741d0
|
|
7
|
+
data.tar.gz: f0960929656a511b43df2340bf07cbd072cd2fabbe8858c35112450bc790c6cfa406114329b93dd954a6d7c9e6f3ebee75a703bd6cf29f8198b0342fb9c292fd
|
data/.olddoc.yml
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
cgit_url:
|
|
2
|
+
cgit_url: https://bogomips.org/raindrops.git
|
|
3
3
|
git_url: git://bogomips.org/raindrops.git
|
|
4
|
-
rdoc_url:
|
|
4
|
+
rdoc_url: https://bogomips.org/raindrops/
|
|
5
5
|
public_email: raindrops-public@bogomips.org
|
|
6
6
|
private_email: raindrops@bogomips.org
|
|
7
|
-
ml_url:
|
|
7
|
+
ml_url:
|
|
8
|
+
- https://bogomips.org/raindrops-public/
|
|
9
|
+
- http://ou63pmih66umazou.onion/raindrops-public
|
|
8
10
|
nntp_url:
|
|
9
|
-
|
|
11
|
+
- nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
|
|
12
|
+
- nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops
|
|
13
|
+
source_code:
|
|
14
|
+
- git clone git://bogomips.org/raindrops.git
|
|
15
|
+
- git clone https://bogomips.org/raindrops.git
|
data/GIT-VERSION-GEN
CHANGED
data/GNUmakefile
CHANGED
data/LICENSE
CHANGED
|
@@ -3,8 +3,8 @@ revision control for names and email addresses of all of them.
|
|
|
3
3
|
|
|
4
4
|
You can redistribute it and/or modify it under the terms of the GNU
|
|
5
5
|
Lesser General Public License (LGPL) as published by the Free Software
|
|
6
|
-
Foundation, version {2.1}[
|
|
7
|
-
later. Currently version {3}[
|
|
6
|
+
Foundation, version {2.1}[https://www.gnu.org/licenses/lgpl-2.1.txt] or
|
|
7
|
+
later. Currently version {3}[https://www.gnu.org/licenses/lgpl-3.0.txt],
|
|
8
8
|
is preferred (see link:COPYING).
|
|
9
9
|
|
|
10
10
|
raindrops is distributed in the hope that it will be useful, but WITHOUT
|
|
@@ -13,4 +13,4 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
13
13
|
License for more details.
|
|
14
14
|
|
|
15
15
|
You should have received a copy of the GNU Lesser General Public License
|
|
16
|
-
along with the raindrops; if not, see <
|
|
16
|
+
along with the raindrops; if not, see <https://www.gnu.org/licenses/>
|
data/README
CHANGED
|
@@ -40,7 +40,7 @@ and "tcp_diag" kernel modules are loaded as they do not autoload correctly
|
|
|
40
40
|
We recommend GCC 4+ (or compatible) to support the __sync builtins
|
|
41
41
|
(__sync_{add,sub}_and_fetch()):
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html
|
|
44
44
|
|
|
45
45
|
For non-GCC 4+ users, we also support compilation with the libatomic_ops
|
|
46
46
|
package starting with Raindrops 0.4.0:
|
|
@@ -54,12 +54,6 @@ If you use RubyGems:
|
|
|
54
54
|
|
|
55
55
|
gem install raindrops
|
|
56
56
|
|
|
57
|
-
Otherwise grab the latest tarball from:
|
|
58
|
-
|
|
59
|
-
http://raindrops.bogomips.org/files/
|
|
60
|
-
|
|
61
|
-
Unpack it, and run "ruby setup.rb"
|
|
62
|
-
|
|
63
57
|
== Usage
|
|
64
58
|
|
|
65
59
|
See Raindrops::Middleware and Raindrops::LastDataRecv documentation for
|
|
@@ -77,7 +71,7 @@ You can get the latest source via git from the following locations:
|
|
|
77
71
|
You may browse the code from the web and download the latest snapshot
|
|
78
72
|
tarballs here:
|
|
79
73
|
|
|
80
|
-
*
|
|
74
|
+
* https://bogomips.org/raindrops.git
|
|
81
75
|
* http://repo.or.cz/w/raindrops.git (gitweb)
|
|
82
76
|
|
|
83
77
|
Inline patches (from "git format-patch") to the mailing list are
|
|
@@ -96,7 +90,7 @@ raindrops is licensed under the LGPL-2.1+
|
|
|
96
90
|
All feedback (bug reports, user/development discussion, patches, pull
|
|
97
91
|
requests) go to the mailing list: mailto:raindrops-public@bogomips.org
|
|
98
92
|
|
|
99
|
-
Mailing list archives are available over
|
|
93
|
+
Mailing list archives are available over HTTPS and NNTP:
|
|
100
94
|
|
|
101
|
-
|
|
102
|
-
nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
|
|
95
|
+
* https://bogomips.org/raindrops-public/
|
|
96
|
+
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
|
data/examples/watcher_demo.ru
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Inlined rack app using yahns server (git clone git://yhbt.net/yahns.git)
|
|
2
|
+
# Usage: yahns -c /path/to/this/file.conf.rb
|
|
3
|
+
# There is no separate config.ru file for this example,
|
|
4
|
+
# but rack_app may also be a string pointing to the path of a
|
|
5
|
+
# config.ru file
|
|
6
|
+
|
|
7
|
+
require 'rack'
|
|
8
|
+
rack_app = Rack::Builder.new do
|
|
9
|
+
use Rack::Head
|
|
10
|
+
addr = %w(0.0.0.0:9418 0.0.0.0:443 [::]:443 0.0.0.0:80 [::]:80
|
|
11
|
+
127.0.0.1:6081 127.0.0.1:280 0.0.0.0:119 [::]:119)
|
|
12
|
+
use Raindrops::Middleware, listeners: addr
|
|
13
|
+
run Raindrops::Watcher.new(listeners: addr)
|
|
14
|
+
end.to_app
|
|
15
|
+
# rack_app = '/path/to/config.ru' # a more standard config
|
|
16
|
+
|
|
17
|
+
app(:rack, rack_app) do
|
|
18
|
+
# I keep IPv4 and IPv6 on separate sockets to avoid ugly
|
|
19
|
+
# IPv4-mapped-IPv6 addresses:
|
|
20
|
+
listen 8080
|
|
21
|
+
listen '[::]:8080', ipv6only: true
|
|
22
|
+
client_max_body_size 0 # no POST or any uploads
|
|
23
|
+
client_timeout 5
|
|
24
|
+
output_buffering false # needed for /tail/ endpoint to avoid ENOSPC
|
|
25
|
+
queue { worker_threads 30 }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# logging is optional, but recommended for diagnosing problems
|
|
29
|
+
# stderr_path '/var/log/yahns/stderr-raindrops.log'
|
|
30
|
+
# stdout_path '/var/log/yahns/stdout-raindrops.log'
|
data/examples/zbatery.conf.rb
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Used for running Raindrops::Watcher, which requires a multi-threaded
|
|
2
2
|
# Rack server capable of streaming a response. Threads must be used,
|
|
3
|
-
# so
|
|
3
|
+
# so any multi-threaded Rack server may be used.
|
|
4
|
+
# zbatery was recommended in the past, but it is abandoned
|
|
5
|
+
# <http://zbatery.bogomip.org/>.
|
|
6
|
+
# yahns may work as an alternative (see yahns.conf.rb in this dir)
|
|
4
7
|
Rainbows! do
|
|
5
8
|
use :ThreadSpawn
|
|
6
9
|
end
|
|
@@ -214,6 +214,10 @@ static const char *addr_any(sa_family_t family)
|
|
|
214
214
|
return ipv6;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
#ifdef __GNUC__
|
|
218
|
+
static void bug_warn_nogvl(const char *, ...)
|
|
219
|
+
__attribute__((format(printf,1,2)));
|
|
220
|
+
#endif
|
|
217
221
|
static void bug_warn_nogvl(const char *fmt, ...)
|
|
218
222
|
{
|
|
219
223
|
va_list ap;
|
|
@@ -126,7 +126,7 @@ void Init_raindrops_linux_tcp_info(void)
|
|
|
126
126
|
* - rcv_space
|
|
127
127
|
* - total_retrans
|
|
128
128
|
*
|
|
129
|
-
*
|
|
129
|
+
* https://kernel.org/doc/man-pages/online/pages/man7/tcp.7.html
|
|
130
130
|
*/
|
|
131
131
|
cTCP_Info = rb_define_class_under(cRaindrops, "TCP_Info", rb_cObject);
|
|
132
132
|
rb_define_alloc_func(cTCP_Info, alloc);
|
data/lib/raindrops/aggregate.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- encoding: binary -*-
|
|
2
2
|
#
|
|
3
|
-
# raindrops may use the {aggregate}[
|
|
3
|
+
# raindrops may use the {aggregate}[https://github.com/josephruscio/aggregate]
|
|
4
4
|
# RubyGem to aggregate statistics from TCP_Info lookups.
|
|
5
5
|
module Raindrops::Aggregate
|
|
6
6
|
autoload :PMQ, "raindrops/aggregate/pmq"
|
data/lib/raindrops/middleware.rb
CHANGED
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
# = Demo Server
|
|
63
63
|
#
|
|
64
64
|
# There is a server running this middleware (and Watcher) at
|
|
65
|
-
#
|
|
65
|
+
# https://raindrops-demo.bogomips.org/_raindrops
|
|
66
66
|
#
|
|
67
|
-
# Also check out the Watcher demo at
|
|
67
|
+
# Also check out the Watcher demo at https://raindrops-demo.bogomips.org/
|
|
68
68
|
#
|
|
69
69
|
# The demo server is only limited to 30 users, so be sure not to abuse it
|
|
70
70
|
# by using the /tail/ endpoint too much.
|
data/lib/raindrops/watcher.rb
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# Raindrops::Watcher is a stand-alone Rack application for watching
|
|
9
9
|
# any number of TCP and UNIX listeners (all of them by default).
|
|
10
10
|
#
|
|
11
|
-
# It depends on the {Aggregate RubyGem}[
|
|
11
|
+
# It depends on the {Aggregate RubyGem}[https://rubygems.org/gems/aggregate]
|
|
12
12
|
#
|
|
13
13
|
# In your Rack config.ru:
|
|
14
14
|
#
|
|
@@ -35,28 +35,28 @@
|
|
|
35
35
|
# Returns a plain text summary + histogram with X-* HTTP headers for
|
|
36
36
|
# active connections.
|
|
37
37
|
#
|
|
38
|
-
# e.g.: curl
|
|
38
|
+
# e.g.: curl https://raindrops-demo.bogomips.org/active/0.0.0.0%3A80.txt
|
|
39
39
|
#
|
|
40
40
|
# === GET /active/$LISTENER.html
|
|
41
41
|
#
|
|
42
42
|
# Returns an HTML summary + histogram with X-* HTTP headers for
|
|
43
43
|
# active connections.
|
|
44
44
|
#
|
|
45
|
-
# e.g.: curl
|
|
45
|
+
# e.g.: curl https://raindrops-demo.bogomips.org/active/0.0.0.0%3A80.html
|
|
46
46
|
#
|
|
47
47
|
# === GET /queued/$LISTENER.txt
|
|
48
48
|
#
|
|
49
49
|
# Returns a plain text summary + histogram with X-* HTTP headers for
|
|
50
50
|
# queued connections.
|
|
51
51
|
#
|
|
52
|
-
# e.g.: curl
|
|
52
|
+
# e.g.: curl https://raindrops-demo.bogomips.org/queued/0.0.0.0%3A80.txt
|
|
53
53
|
#
|
|
54
54
|
# === GET /queued/$LISTENER.html
|
|
55
55
|
#
|
|
56
56
|
# Returns an HTML summary + histogram with X-* HTTP headers for
|
|
57
57
|
# queued connections.
|
|
58
58
|
#
|
|
59
|
-
# e.g.: curl
|
|
59
|
+
# e.g.: curl https://raindrops-demo.bogomips.org/queued/0.0.0.0%3A80.html
|
|
60
60
|
#
|
|
61
61
|
# === POST /reset/$LISTENER
|
|
62
62
|
#
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
#
|
|
96
96
|
# = Demo Server
|
|
97
97
|
#
|
|
98
|
-
# There is a server running this app at
|
|
98
|
+
# There is a server running this app at https://raindrops-demo.bogomips.org/
|
|
99
99
|
# The Raindrops::Middleware demo is also accessible at
|
|
100
|
-
#
|
|
100
|
+
# https://raindrops-demo.bogomips.org/_raindrops
|
|
101
101
|
#
|
|
102
102
|
# The demo server is only limited to 30 users, so be sure not to abuse it
|
|
103
103
|
# by using the /tail/ endpoint too much.
|
|
@@ -106,7 +106,7 @@ class Raindrops::Watcher
|
|
|
106
106
|
attr_reader :snapshot
|
|
107
107
|
include Rack::Utils
|
|
108
108
|
include Raindrops::Linux
|
|
109
|
-
DOC_URL = "
|
|
109
|
+
DOC_URL = "https://bogomips.org/raindrops/Raindrops/Watcher.html"
|
|
110
110
|
Peak = Struct.new(:first, :last)
|
|
111
111
|
|
|
112
112
|
def initialize(opts = {})
|
|
@@ -244,10 +244,10 @@ def agg_to_hash(reset_at, agg, current, peak)
|
|
|
244
244
|
def histogram_txt(agg)
|
|
245
245
|
updated_at, reset_at, agg, current, peak = *agg
|
|
246
246
|
headers = agg_to_hash(reset_at, agg, current, peak)
|
|
247
|
-
body = agg.to_s
|
|
247
|
+
body = agg.to_s # 7-bit ASCII-clean
|
|
248
248
|
headers["Content-Type"] = "text/plain"
|
|
249
249
|
headers["Expires"] = (updated_at + @delay).httpdate
|
|
250
|
-
headers["Content-Length"] =
|
|
250
|
+
headers["Content-Length"] = body.size.to_s
|
|
251
251
|
[ 200, headers, [ body ] ]
|
|
252
252
|
end
|
|
253
253
|
|
|
@@ -265,7 +265,7 @@ def histogram_html(agg, addr)
|
|
|
265
265
|
"</body>"
|
|
266
266
|
headers["Content-Type"] = "text/html"
|
|
267
267
|
headers["Expires"] = (updated_at + @delay).httpdate
|
|
268
|
-
headers["Content-Length"] =
|
|
268
|
+
headers["Content-Length"] = body.size.to_s
|
|
269
269
|
[ 200, headers, [ body ] ]
|
|
270
270
|
end
|
|
271
271
|
|
|
@@ -364,7 +364,7 @@ def index
|
|
|
364
364
|
"for more information and options." \
|
|
365
365
|
"</p>" \
|
|
366
366
|
"</body></html>"
|
|
367
|
-
headers["Content-Length"] =
|
|
367
|
+
headers["Content-Length"] = body.size.to_s
|
|
368
368
|
[ 200, headers, [ body ] ]
|
|
369
369
|
end
|
|
370
370
|
|
|
@@ -382,7 +382,7 @@ def initialize(rdmon, addr, env) # :nodoc:
|
|
|
382
382
|
q = Rack::Utils.parse_query env["QUERY_STRING"]
|
|
383
383
|
@active_min = q["active_min"].to_i
|
|
384
384
|
@queued_min = q["queued_min"].to_i
|
|
385
|
-
len =
|
|
385
|
+
len = addr.size
|
|
386
386
|
len = 35 if len > 35
|
|
387
387
|
@fmt = "%20s % #{len}s % 10u % 10u\n"
|
|
388
388
|
case env["HTTP_VERSION"]
|
data/raindrops.gemspec
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
s.add_development_dependency('test-unit', '~> 3.0')
|
|
24
24
|
s.add_development_dependency('io-extra', [ '~> 1.2', '>= 1.2.3'])
|
|
25
25
|
s.add_development_dependency('posix_mq', '~> 2.0')
|
|
26
|
-
s.add_development_dependency('rack', '
|
|
26
|
+
s.add_development_dependency('rack', [ '>= 1.2', '< 3.0' ])
|
|
27
27
|
s.add_development_dependency('olddoc', '~> 1.0')
|
|
28
28
|
|
|
29
29
|
s.licenses = %w(LGPL-2.1+)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: raindrops
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.17.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- raindrops hackers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-07-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aggregate
|
|
@@ -76,16 +76,22 @@ dependencies:
|
|
|
76
76
|
name: rack
|
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
|
-
- - "
|
|
79
|
+
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '1.2'
|
|
82
|
+
- - "<"
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: '3.0'
|
|
82
85
|
type: :development
|
|
83
86
|
prerelease: false
|
|
84
87
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
88
|
requirements:
|
|
86
|
-
- - "
|
|
89
|
+
- - ">="
|
|
87
90
|
- !ruby/object:Gem::Version
|
|
88
91
|
version: '1.2'
|
|
92
|
+
- - "<"
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '3.0'
|
|
89
95
|
- !ruby/object:Gem::Dependency
|
|
90
96
|
name: olddoc
|
|
91
97
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -148,6 +154,7 @@ files:
|
|
|
148
154
|
- examples/middleware.ru
|
|
149
155
|
- examples/watcher.ru
|
|
150
156
|
- examples/watcher_demo.ru
|
|
157
|
+
- examples/yahns.conf.rb
|
|
151
158
|
- examples/zbatery.conf.rb
|
|
152
159
|
- ext/raindrops/extconf.rb
|
|
153
160
|
- ext/raindrops/linux_inet_diag.c
|
|
@@ -186,7 +193,7 @@ files:
|
|
|
186
193
|
- test/test_raindrops_gc.rb
|
|
187
194
|
- test/test_struct.rb
|
|
188
195
|
- test/test_watcher.rb
|
|
189
|
-
homepage:
|
|
196
|
+
homepage: https://bogomips.org/raindrops/
|
|
190
197
|
licenses:
|
|
191
198
|
- LGPL-2.1+
|
|
192
199
|
metadata: {}
|
|
@@ -206,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
206
213
|
version: '0'
|
|
207
214
|
requirements: []
|
|
208
215
|
rubyforge_project:
|
|
209
|
-
rubygems_version: 2.
|
|
216
|
+
rubygems_version: 2.6.6
|
|
210
217
|
signing_key:
|
|
211
218
|
specification_version: 4
|
|
212
219
|
summary: real-time stats for preforking Rack servers
|