raindrops 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -2
- data/GIT-VERSION-GEN +1 -1
- data/ext/raindrops/linux_inet_diag.c +3 -3
- data/ext/raindrops/linux_tcp_info.c +1 -0
- data/ext/raindrops/raindrops.c +8 -6
- data/lib/raindrops/watcher.rb +6 -6
- data/raindrops.gemspec +5 -1
- data/test/test_linux_tcp_info.rb +7 -0
- metadata +153 -60
- data/Gemfile +0 -6
data/.gitignore
CHANGED
data/GIT-VERSION-GEN
CHANGED
@@ -70,8 +70,8 @@ static ID id_new;
|
|
70
70
|
|
71
71
|
struct listen_stats {
|
72
72
|
uint32_t active;
|
73
|
-
uint32_t
|
74
|
-
uint32_t
|
73
|
+
uint32_t queued;
|
74
|
+
uint32_t listener_p;
|
75
75
|
};
|
76
76
|
|
77
77
|
#define OPLEN (sizeof(struct inet_diag_bc_op) + \
|
@@ -189,7 +189,7 @@ static struct listen_stats *stats_for(st_table *table, struct inet_diag_msg *r)
|
|
189
189
|
struct listen_stats *stats;
|
190
190
|
size_t keylen;
|
191
191
|
size_t portlen = sizeof("65535");
|
192
|
-
union any_addr sa
|
192
|
+
union any_addr sa;
|
193
193
|
socklen_t len = sizeof(struct sockaddr_storage);
|
194
194
|
int rc;
|
195
195
|
int flags = NI_NUMERICHOST | NI_NUMERICSERV;
|
@@ -131,6 +131,7 @@ void Init_raindrops_linux_tcp_info(void)
|
|
131
131
|
cTCP_Info = rb_define_class_under(cRaindrops, "TCP_Info", rb_cObject);
|
132
132
|
rb_define_alloc_func(cTCP_Info, alloc);
|
133
133
|
rb_define_private_method(cTCP_Info, "initialize", init, 1);
|
134
|
+
rb_define_method(cTCP_Info, "get!", init, 1);
|
134
135
|
|
135
136
|
#define TCPI_DEFINE_METHOD(x) \
|
136
137
|
rb_define_method(cTCP_Info, #x, tcp_info_##x, 0)
|
data/ext/raindrops/raindrops.c
CHANGED
@@ -326,11 +326,13 @@ void Init_raindrops_linux_inet_diag(void);
|
|
326
326
|
void Init_raindrops_linux_tcp_info(void);
|
327
327
|
#endif
|
328
328
|
|
329
|
-
#ifndef
|
330
|
-
#
|
331
|
-
# define _SC_NPROCESSORS_ONLN
|
329
|
+
#ifndef _SC_NPROCESSORS_CONF
|
330
|
+
# if defined _SC_NPROCESSORS_ONLN
|
331
|
+
# define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_ONLN
|
332
|
+
# elif defined _SC_NPROC_ONLN
|
333
|
+
# define _SC_NPROCESSORS_CONF _SC_NPROC_ONLN
|
332
334
|
# elif defined _SC_CRAY_NCPU
|
333
|
-
# define
|
335
|
+
# define _SC_NPROCESSORS_CONF _SC_CRAY_NCPU
|
334
336
|
# endif
|
335
337
|
#endif
|
336
338
|
|
@@ -359,8 +361,8 @@ void Init_raindrops_ext(void)
|
|
359
361
|
VALUE cRaindrops = rb_define_class("Raindrops", rb_cObject);
|
360
362
|
long tmp = 2;
|
361
363
|
|
362
|
-
#ifdef
|
363
|
-
tmp = sysconf(
|
364
|
+
#ifdef _SC_NPROCESSORS_CONF
|
365
|
+
tmp = sysconf(_SC_NPROCESSORS_CONF);
|
364
366
|
#endif
|
365
367
|
/* no point in padding on single CPU machines */
|
366
368
|
if (tmp == 1)
|
data/lib/raindrops/watcher.rb
CHANGED
@@ -260,7 +260,7 @@ class Raindrops::Watcher
|
|
260
260
|
headers.map { |k,v|
|
261
261
|
"<tr><td>#{k.gsub(/^X-/, '')}</td><td>#{v}</td></tr>"
|
262
262
|
}.join << "</table><pre>#{escape_html agg}</pre>" \
|
263
|
-
"<form action='
|
263
|
+
"<form action='../reset/#{escape addr}' method='post'>" \
|
264
264
|
"<input type='submit' name='x' value='reset' /></form>" \
|
265
265
|
"</body>"
|
266
266
|
headers["Content-Type"] = "text/html"
|
@@ -323,7 +323,7 @@ class Raindrops::Watcher
|
|
323
323
|
res = Rack::Response.new
|
324
324
|
url = req.referer || "#{req.host_with_port}/"
|
325
325
|
res.redirect(url)
|
326
|
-
res
|
326
|
+
res["Content-Type"] = "text/plain"
|
327
327
|
res.write "Redirecting to #{url}"
|
328
328
|
res.finish
|
329
329
|
end
|
@@ -346,14 +346,14 @@ class Raindrops::Watcher
|
|
346
346
|
end.map do |addr,stats|
|
347
347
|
e_addr = escape addr
|
348
348
|
"<tr>" \
|
349
|
-
"<td><a href='
|
349
|
+
"<td><a href='tail/#{e_addr}.txt' " \
|
350
350
|
"title='"tail" output in real time'" \
|
351
351
|
">#{escape_html addr}</a></td>" \
|
352
|
-
"<td><a href='
|
352
|
+
"<td><a href='active/#{e_addr}.html' " \
|
353
353
|
"title='show active connection stats'>#{stats.active}</a></td>" \
|
354
|
-
"<td><a href='
|
354
|
+
"<td><a href='queued/#{e_addr}.html' " \
|
355
355
|
"title='show queued connection stats'>#{stats.queued}</a></td>" \
|
356
|
-
"<td><form action='
|
356
|
+
"<td><form action='reset/#{e_addr}' method='post'>" \
|
357
357
|
"<input title='reset statistics' " \
|
358
358
|
"type='submit' name='x' value='x' /></form></td>" \
|
359
359
|
"</tr>" \
|
data/raindrops.gemspec
CHANGED
@@ -22,7 +22,11 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.rdoc_options = rdoc_options
|
23
23
|
s.rubyforge_project = %q{rainbows}
|
24
24
|
s.test_files = test_files
|
25
|
-
s.add_development_dependency('
|
25
|
+
s.add_development_dependency('aggregate', '~> 0.2')
|
26
|
+
s.add_development_dependency('io-extra', [ '~> 1.2', '>= 1.2.3'])
|
27
|
+
s.add_development_dependency('posix_mq', '~> 2.0')
|
28
|
+
s.add_development_dependency('rack', '~> 1.2')
|
29
|
+
s.add_development_dependency('unicorn', '>= 0.98')
|
26
30
|
|
27
31
|
# s.licenses = %w(LGPLv3) # accessor not compatible with older RubyGems
|
28
32
|
end
|
data/test/test_linux_tcp_info.rb
CHANGED
@@ -12,6 +12,7 @@ class TestLinuxTCP_Info < Test::Unit::TestCase
|
|
12
12
|
# Linux kernel commit 5ee3afba88f5a79d0bff07ddd87af45919259f91
|
13
13
|
TCP_INFO_useful_listenq = `uname -r`.strip >= '2.6.24'
|
14
14
|
|
15
|
+
|
15
16
|
def test_tcp_server
|
16
17
|
s = TCPServer.new(TEST_ADDR, 0)
|
17
18
|
rv = Raindrops::TCP_Info.new s
|
@@ -23,6 +24,11 @@ class TestLinuxTCP_Info < Test::Unit::TestCase
|
|
23
24
|
a = s.accept
|
24
25
|
tmp = Raindrops::TCP_Info.new s
|
25
26
|
assert_equal 0, tmp.unacked
|
27
|
+
before = tmp.object_id
|
28
|
+
|
29
|
+
tmp.get!(s)
|
30
|
+
assert_equal before, tmp.object_id
|
31
|
+
|
26
32
|
ensure
|
27
33
|
c.close if c
|
28
34
|
a.close if a
|
@@ -35,6 +41,7 @@ class TestLinuxTCP_Info < Test::Unit::TestCase
|
|
35
41
|
tcp_info_methods = tmp.methods - Object.new.methods
|
36
42
|
assert tcp_info_methods.size >= 32
|
37
43
|
tcp_info_methods.each do |m|
|
44
|
+
next if m.to_sym == :get!
|
38
45
|
val = tmp.__send__ m
|
39
46
|
assert_kind_of Integer, val
|
40
47
|
assert val >= 0
|
metadata
CHANGED
@@ -1,51 +1,152 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
2
|
-
name:
|
3
|
-
|
4
|
-
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: !binary |-
|
3
|
+
cmFpbmRyb3Bz
|
4
|
+
version: !ruby/object:Gem::Version
|
5
|
+
version: 0.11.0
|
5
6
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 10
|
9
|
-
- 0
|
10
|
-
version: 0.10.0
|
11
7
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
8
|
+
authors:
|
9
|
+
- !binary |-
|
10
|
+
cmFpbmRyb3BzIGhhY2tlcnM=
|
14
11
|
autorequire:
|
15
12
|
bindir: bin
|
16
13
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
date: 2013-04-20 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: !binary |-
|
18
|
+
YWdncmVnYXRl
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - !binary |-
|
23
|
+
fj4=
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: !binary |-
|
26
|
+
MC4y
|
27
|
+
type: :development
|
28
|
+
prerelease: false
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - !binary |-
|
33
|
+
fj4=
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: !binary |-
|
36
|
+
MC4y
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: !binary |-
|
39
|
+
aW8tZXh0cmE=
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - !binary |-
|
44
|
+
fj4=
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: !binary |-
|
47
|
+
MS4y
|
48
|
+
- - !binary |-
|
49
|
+
Pj0=
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: !binary |-
|
52
|
+
MS4yLjM=
|
53
|
+
type: :development
|
22
54
|
prerelease: false
|
23
|
-
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
56
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
57
|
+
requirements:
|
58
|
+
- - !binary |-
|
59
|
+
fj4=
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: !binary |-
|
62
|
+
MS4y
|
63
|
+
- - !binary |-
|
64
|
+
Pj0=
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: !binary |-
|
67
|
+
MS4yLjM=
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: !binary |-
|
70
|
+
cG9zaXhfbXE=
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - !binary |-
|
75
|
+
fj4=
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: !binary |-
|
78
|
+
Mi4w
|
34
79
|
type: :development
|
35
|
-
|
36
|
-
|
37
|
-
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - !binary |-
|
85
|
+
fj4=
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: !binary |-
|
88
|
+
Mi4w
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: !binary |-
|
91
|
+
cmFjaw==
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - !binary |-
|
96
|
+
fj4=
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: !binary |-
|
99
|
+
MS4y
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - !binary |-
|
106
|
+
fj4=
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: !binary |-
|
109
|
+
MS4y
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: !binary |-
|
112
|
+
dW5pY29ybg==
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - !binary |-
|
117
|
+
Pj0=
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: !binary |-
|
120
|
+
MC45OA==
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - !binary |-
|
127
|
+
Pj0=
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: !binary |-
|
130
|
+
MC45OA==
|
131
|
+
description: ! 'Raindrops is a real-time stats toolkit to show statistics for Rack
|
132
|
+
HTTP
|
133
|
+
|
38
134
|
servers. It is designed for preforking servers such as Rainbows! and
|
135
|
+
|
39
136
|
Unicorn, but should support any Rack HTTP server under Ruby 1.9, 1.8 and
|
137
|
+
|
40
138
|
Rubinius on platforms supporting POSIX shared memory. It may also be
|
139
|
+
|
41
140
|
used as a generic scoreboard for sharing atomic counters across multiple
|
42
|
-
processes.
|
43
|
-
email: raindrops@librelist.org
|
44
|
-
executables: []
|
45
141
|
|
46
|
-
|
47
|
-
|
48
|
-
|
142
|
+
processes.'
|
143
|
+
email: !binary |-
|
144
|
+
cmFpbmRyb3BzQGxpYnJlbGlzdC5vcmc=
|
145
|
+
executables: []
|
146
|
+
extensions:
|
147
|
+
- !binary |-
|
148
|
+
ZXh0L3JhaW5kcm9wcy9leHRjb25mLnJi
|
149
|
+
extra_rdoc_files:
|
49
150
|
- README
|
50
151
|
- LICENSE
|
51
152
|
- NEWS
|
@@ -63,7 +164,7 @@ extra_rdoc_files:
|
|
63
164
|
- ext/raindrops/raindrops.c
|
64
165
|
- ext/raindrops/linux_inet_diag.c
|
65
166
|
- ext/raindrops/linux_tcp_info.c
|
66
|
-
files:
|
167
|
+
files:
|
67
168
|
- .document
|
68
169
|
- .gitignore
|
69
170
|
- .manifest
|
@@ -73,7 +174,6 @@ files:
|
|
73
174
|
- GIT-VERSION-FILE
|
74
175
|
- GIT-VERSION-GEN
|
75
176
|
- GNUmakefile
|
76
|
-
- Gemfile
|
77
177
|
- LATEST
|
78
178
|
- LICENSE
|
79
179
|
- NEWS
|
@@ -124,41 +224,34 @@ files:
|
|
124
224
|
- test/test_watcher.rb
|
125
225
|
homepage: http://raindrops.bogomips.org/
|
126
226
|
licenses: []
|
127
|
-
|
128
227
|
post_install_message:
|
129
|
-
rdoc_options:
|
228
|
+
rdoc_options:
|
130
229
|
- -t
|
131
230
|
- raindrops - real-time stats for preforking Rack servers
|
132
231
|
- -W
|
133
232
|
- http://bogomips.org/raindrops.git/tree/%s
|
134
|
-
require_paths:
|
233
|
+
require_paths:
|
135
234
|
- lib
|
136
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
235
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
236
|
none: false
|
138
|
-
requirements:
|
139
|
-
- -
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
|
142
|
-
|
143
|
-
- 0
|
144
|
-
version: "0"
|
145
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
237
|
+
requirements:
|
238
|
+
- - ! '>='
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: '0'
|
241
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
242
|
none: false
|
147
|
-
requirements:
|
148
|
-
- -
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
|
151
|
-
segments:
|
152
|
-
- 0
|
153
|
-
version: "0"
|
243
|
+
requirements:
|
244
|
+
- - ! '>='
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: '0'
|
154
247
|
requirements: []
|
155
|
-
|
156
|
-
|
157
|
-
rubygems_version: 1.8.
|
248
|
+
rubyforge_project: !binary |-
|
249
|
+
cmFpbmJvd3M=
|
250
|
+
rubygems_version: 1.8.23
|
158
251
|
signing_key:
|
159
252
|
specification_version: 3
|
160
253
|
summary: real-time stats for preforking Rack servers
|
161
|
-
test_files:
|
254
|
+
test_files:
|
162
255
|
- test/test_aggregate_pmq.rb
|
163
256
|
- test/test_inet_diag_socket.rb
|
164
257
|
- test/test_last_data_recv_unicorn.rb
|