redis-stat 0.4.9-java → 0.4.10-java
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/lib/redis-stat/option.rb +13 -8
- data/lib/redis-stat/server/public/jqplot/jqplot.canvasAxisLabelRenderer.min.js +3 -57
- data/lib/redis-stat/server/public/jqplot/jqplot.canvasAxisTickRenderer.min.js +3 -57
- data/lib/redis-stat/server/public/jqplot/jqplot.canvasTextRenderer.min.js +3 -57
- data/lib/redis-stat/server/public/jqplot/jquery.jqplot.min.css +1 -1
- data/lib/redis-stat/server/public/jqplot/jquery.jqplot.min.js +3 -57
- data/lib/redis-stat/server/public/js/site.js +9 -9
- data/lib/redis-stat/server/views/index.erb +0 -4
- data/lib/redis-stat/version.rb +1 -1
- data/lib/redis-stat.rb +30 -9
- data/test/test_redis-stat.rb +29 -9
- metadata +2 -3
- data/lib/redis-stat/server/public/forkme.png +0 -0
@@ -32,7 +32,7 @@ var initialize = function(params) {
|
|
32
32
|
xaxis: {
|
33
33
|
pad: 1,
|
34
34
|
min: - max,
|
35
|
-
tickOptions: { show:
|
35
|
+
tickOptions: { show: false }
|
36
36
|
},
|
37
37
|
yaxis: {
|
38
38
|
label:'Commands/sec',
|
@@ -41,10 +41,10 @@ var initialize = function(params) {
|
|
41
41
|
}
|
42
42
|
},
|
43
43
|
grid: {
|
44
|
-
borderWidth:
|
44
|
+
borderWidth: 1.0,
|
45
45
|
borderColor: '#ddd',
|
46
46
|
background: '#ffffff',
|
47
|
-
|
47
|
+
shadow: false
|
48
48
|
}
|
49
49
|
},
|
50
50
|
chart2: {
|
@@ -67,7 +67,7 @@ var initialize = function(params) {
|
|
67
67
|
xaxis: {
|
68
68
|
pad: 1,
|
69
69
|
min: - max,
|
70
|
-
tickOptions: { show:
|
70
|
+
tickOptions: { show: false }
|
71
71
|
},
|
72
72
|
yaxis: {
|
73
73
|
label:'CPU usage',
|
@@ -80,10 +80,10 @@ var initialize = function(params) {
|
|
80
80
|
location: 'se'
|
81
81
|
},
|
82
82
|
grid: {
|
83
|
-
borderWidth:
|
83
|
+
borderWidth: 1.0,
|
84
84
|
borderColor: '#ddd',
|
85
85
|
background: '#ffffff',
|
86
|
-
|
86
|
+
shadow: false
|
87
87
|
}
|
88
88
|
},
|
89
89
|
chart3: {
|
@@ -104,7 +104,7 @@ var initialize = function(params) {
|
|
104
104
|
xaxis: {
|
105
105
|
pad: 1,
|
106
106
|
min: - max,
|
107
|
-
tickOptions: { show:
|
107
|
+
tickOptions: { show: false }
|
108
108
|
},
|
109
109
|
yaxis: {
|
110
110
|
label:'Memory usage',
|
@@ -120,10 +120,10 @@ var initialize = function(params) {
|
|
120
120
|
location: 'se'
|
121
121
|
},
|
122
122
|
grid: {
|
123
|
-
borderWidth:
|
123
|
+
borderWidth: 1.0,
|
124
124
|
borderColor: '#ddd',
|
125
125
|
background: '#ffffff',
|
126
|
-
|
126
|
+
shadow: false
|
127
127
|
}
|
128
128
|
},
|
129
129
|
} // chart_options
|
@@ -132,10 +132,6 @@
|
|
132
132
|
|
133
133
|
</div>
|
134
134
|
|
135
|
-
<a href="https://github.com/junegunn/redis-stat">
|
136
|
-
<img style="position: fixed; top: 0; right: 0; border: 0; z-index: 10000" src="/forkme.png" alt="Fork me on GitHub">
|
137
|
-
</a>
|
138
|
-
|
139
135
|
<footer class="footer">
|
140
136
|
<div class="container">
|
141
137
|
<p>Powered by <a href="http://twitter.github.com/bootstrap/">Bootstrap</a>, <a href="http://jquery.com/">jQuery</a> and <a href="http://www.jqplot.com/">jqPlot</a>.</p>
|
data/lib/redis-stat/version.rb
CHANGED
data/lib/redis-stat.rb
CHANGED
@@ -37,7 +37,8 @@ class RedisStat
|
|
37
37
|
}
|
38
38
|
@max_count = options[:count]
|
39
39
|
@colors = options[:colors] || COLORS
|
40
|
-
@
|
40
|
+
@csv_file = options[:csv_file]
|
41
|
+
@csv_output = options[:csv_output]
|
41
42
|
@auth = options[:auth]
|
42
43
|
@verbose = options[:verbose]
|
43
44
|
@measures = MEASURES[ @verbose ? :verbose : :default ].map { |m| [*m].first }
|
@@ -53,13 +54,33 @@ class RedisStat
|
|
53
54
|
@elasticsearch = options[:es] && ElasticsearchSink.new(@hosts, options[:es])
|
54
55
|
end
|
55
56
|
|
56
|
-
def
|
57
|
+
def output_stream! stream
|
58
|
+
if @csv_output
|
59
|
+
class << $stderr
|
60
|
+
alias puts! puts
|
61
|
+
def puts(*args); end
|
62
|
+
def print(*args); end
|
63
|
+
end
|
64
|
+
$stderr
|
65
|
+
else
|
66
|
+
class << stream
|
67
|
+
alias puts! puts
|
68
|
+
end
|
69
|
+
stream
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def start stream
|
57
74
|
@started_at = Time.now
|
58
|
-
@os = output_stream
|
75
|
+
@os = output_stream!(stream)
|
59
76
|
trap('INT') { Thread.main.raise Interrupt }
|
60
77
|
|
61
78
|
begin
|
62
|
-
csv =
|
79
|
+
csv = if @csv_file
|
80
|
+
File.open(File.expand_path(@csv_file), 'w')
|
81
|
+
elsif @csv_output
|
82
|
+
$stdout
|
83
|
+
end
|
63
84
|
update_term_size!
|
64
85
|
authenticate!
|
65
86
|
|
@@ -108,7 +129,7 @@ class RedisStat
|
|
108
129
|
end
|
109
130
|
error_messages = format_exceptions(exceptions)
|
110
131
|
info_output = @measures.map { |key| [key, info_output_all[key][:sum]] }
|
111
|
-
|
132
|
+
if !@daemonized && !@csv_output
|
112
133
|
output_static_info info if @count == 0
|
113
134
|
output_term info_output, error_messages
|
114
135
|
end
|
@@ -123,7 +144,7 @@ class RedisStat
|
|
123
144
|
@os.puts
|
124
145
|
rescue Interrupt
|
125
146
|
@os.puts
|
126
|
-
@os.puts "Interrupted.".yellow.bold
|
147
|
+
@os.puts! "Interrupted.".yellow.bold
|
127
148
|
if @server_thr
|
128
149
|
@server_thr.raise Interrupt
|
129
150
|
@server_thr.join
|
@@ -131,12 +152,12 @@ class RedisStat
|
|
131
152
|
rescue SystemExit
|
132
153
|
raise
|
133
154
|
rescue Exception => e
|
134
|
-
@os.puts e.to_s.red.bold
|
155
|
+
@os.puts! e.to_s.red.bold
|
135
156
|
raise
|
136
157
|
ensure
|
137
158
|
csv.close if csv
|
138
159
|
end
|
139
|
-
@os.puts "Elapsed: #{"%.2f" % (Time.now - @started_at)} sec.".blue.bold
|
160
|
+
@os.puts! "Elapsed: #{"%.2f" % (Time.now - @started_at)} sec.".blue.bold
|
140
161
|
end
|
141
162
|
|
142
163
|
private
|
@@ -289,7 +310,7 @@ private
|
|
289
310
|
end
|
290
311
|
|
291
312
|
def output_term_errors! error_messages
|
292
|
-
@os.puts error_messages.join($/).red.bold
|
313
|
+
@os.puts! error_messages.join($/).red.bold
|
293
314
|
end
|
294
315
|
|
295
316
|
def output_term info_output, error_messages
|
data/test/test_redis-stat.rb
CHANGED
@@ -52,7 +52,8 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
52
52
|
:hosts => ['localhost:1000'],
|
53
53
|
:interval => 20,
|
54
54
|
:count => nil,
|
55
|
-
:
|
55
|
+
:csv_file => nil,
|
56
|
+
:csv_output => false,
|
56
57
|
:style => :unicode
|
57
58
|
}.sort, options.sort)
|
58
59
|
|
@@ -61,7 +62,8 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
61
62
|
:hosts => ['localhost:1000'],
|
62
63
|
:interval => 20,
|
63
64
|
:count => 30,
|
64
|
-
:
|
65
|
+
:csv_file => nil,
|
66
|
+
:csv_output => false,
|
65
67
|
:style => :unicode
|
66
68
|
}.sort, options.sort)
|
67
69
|
|
@@ -70,7 +72,8 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
70
72
|
:hosts => ['127.0.0.1:6379'],
|
71
73
|
:interval => 20,
|
72
74
|
:count => nil,
|
73
|
-
:
|
75
|
+
:csv_file => nil,
|
76
|
+
:csv_output => false,
|
74
77
|
:style => :unicode
|
75
78
|
}.sort, options.sort)
|
76
79
|
|
@@ -79,7 +82,8 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
79
82
|
:hosts => ['127.0.0.1:6379'],
|
80
83
|
:interval => 20,
|
81
84
|
:count => 30,
|
82
|
-
:
|
85
|
+
:csv_file => nil,
|
86
|
+
:csv_output => false,
|
83
87
|
:style => :unicode
|
84
88
|
}.sort, options.sort)
|
85
89
|
|
@@ -89,7 +93,8 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
89
93
|
:hosts => ['localhost:8888'],
|
90
94
|
:interval => 10,
|
91
95
|
:count => nil,
|
92
|
-
:
|
96
|
+
:csv_file => '/tmp/a.csv',
|
97
|
+
:csv_output => false,
|
93
98
|
:style => :ascii
|
94
99
|
}.sort, options.sort)
|
95
100
|
|
@@ -99,7 +104,8 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
99
104
|
:hosts => ['localhost:8888'],
|
100
105
|
:interval => 10,
|
101
106
|
:count => nil,
|
102
|
-
:
|
107
|
+
:csv_file => '/tmp/a.csv',
|
108
|
+
:csv_output => false,
|
103
109
|
:style => :ascii
|
104
110
|
}.sort, options.sort)
|
105
111
|
|
@@ -109,7 +115,20 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
109
115
|
:hosts => ['localhost:8888'],
|
110
116
|
:interval => 10,
|
111
117
|
:count => nil,
|
112
|
-
:
|
118
|
+
:csv_file => '/tmp/a.csv',
|
119
|
+
:csv_output => false,
|
120
|
+
:style => :ascii,
|
121
|
+
:es => %w[http://localhost index]
|
122
|
+
}.sort, options.sort)
|
123
|
+
|
124
|
+
options = RedisStat::Option.parse(%w[-h localhost:8888 10 -a password --csv --style=ascii --es=localhost/index])
|
125
|
+
assert_equal({
|
126
|
+
:auth => 'password',
|
127
|
+
:hosts => ['localhost:8888'],
|
128
|
+
:interval => 10,
|
129
|
+
:count => nil,
|
130
|
+
:csv_file => nil,
|
131
|
+
:csv_output => true,
|
113
132
|
:style => :ascii,
|
114
133
|
:es => %w[http://localhost index]
|
115
134
|
}.sort, options.sort)
|
@@ -126,7 +145,8 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
126
145
|
:hosts => ['localhost:8888'],
|
127
146
|
:interval => 10,
|
128
147
|
:count => nil,
|
129
|
-
:
|
148
|
+
:csv_file => '/tmp/a.csv',
|
149
|
+
:csv_output => false,
|
130
150
|
:server_port => "5555",
|
131
151
|
:style => :ascii,
|
132
152
|
:daemon => true
|
@@ -160,7 +180,7 @@ class TestRedisStat < MiniTest::Unit::TestCase
|
|
160
180
|
csv = '/tmp/redis-stat.csv'
|
161
181
|
cnt = 100
|
162
182
|
rs = RedisStat.new :hosts => %w[localhost] * 5, :interval => 0.01, :count => cnt,
|
163
|
-
:verbose => true, :
|
183
|
+
:verbose => true, :csv_file => csv, :auth => 'pw'
|
164
184
|
rs.start $stdout
|
165
185
|
|
166
186
|
assert_equal cnt + 1, File.read(csv).lines.to_a.length
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-stat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.10
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Junegunn Choi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ansi256
|
@@ -191,7 +191,6 @@ files:
|
|
191
191
|
- lib/redis-stat/server/public/css/site.css
|
192
192
|
- lib/redis-stat/server/public/favicon.ico
|
193
193
|
- lib/redis-stat/server/public/favicon.png
|
194
|
-
- lib/redis-stat/server/public/forkme.png
|
195
194
|
- lib/redis-stat/server/public/jqplot/jqplot.canvasAxisLabelRenderer.min.js
|
196
195
|
- lib/redis-stat/server/public/jqplot/jqplot.canvasAxisTickRenderer.min.js
|
197
196
|
- lib/redis-stat/server/public/jqplot/jqplot.canvasTextRenderer.min.js
|
Binary file
|