redis-stat 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/lib/redis-stat.rb +18 -0
- data/lib/redis-stat/constants.rb +7 -1
- data/lib/redis-stat/server.rb +1 -1
- data/lib/redis-stat/server/public/css/site.css +1 -1
- data/lib/redis-stat/version.rb +1 -1
- data/redis-stat.gemspec +1 -0
- metadata +4 -3
data/README.md
CHANGED
data/lib/redis-stat.rb
CHANGED
@@ -290,6 +290,14 @@ private
|
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
293
|
+
get_ratio = lambda do |x, y|
|
294
|
+
if x > 0 || y > 0
|
295
|
+
x / (x + y) * 100
|
296
|
+
else
|
297
|
+
nil
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
293
301
|
case key
|
294
302
|
when :at
|
295
303
|
val = Time.now.strftime('%H:%M:%S')
|
@@ -310,6 +318,16 @@ private
|
|
310
318
|
when :used_memory, :used_memory_rss, :aof_current_size, :aof_base_size
|
311
319
|
val = info.sumf(key)
|
312
320
|
[humanize_number(val.to_i, true), val]
|
321
|
+
when :keyspace_hit_ratio
|
322
|
+
hits = info.sumf(:keyspace_hits)
|
323
|
+
misses = info.sumf(:keyspace_misses)
|
324
|
+
val = get_ratio.call(hits, misses)
|
325
|
+
[humanize_number(val), val]
|
326
|
+
when :keyspace_hit_ratio_per_second
|
327
|
+
hits = get_diff.call(:keyspace_hits) || 0
|
328
|
+
misses = get_diff.call(:keyspace_misses) || 0
|
329
|
+
val = get_ratio.call(hits, misses)
|
330
|
+
[humanize_number(val), val]
|
313
331
|
else
|
314
332
|
val = info.sumf(key)
|
315
333
|
[humanize_number(val), val]
|
data/lib/redis-stat/constants.rb
CHANGED
@@ -31,10 +31,10 @@ class RedisStat
|
|
31
31
|
:total_commands_processed_per_second,
|
32
32
|
:expired_keys_per_second,
|
33
33
|
:evicted_keys_per_second,
|
34
|
+
:keyspace_hit_ratio_per_second,
|
34
35
|
:keyspace_hits_per_second,
|
35
36
|
:keyspace_misses_per_second,
|
36
37
|
:aof_current_size,
|
37
|
-
:pubsub_channels,
|
38
38
|
],
|
39
39
|
:verbose => [
|
40
40
|
:at,
|
@@ -52,6 +52,8 @@ class RedisStat
|
|
52
52
|
:expired_keys,
|
53
53
|
:evicted_keys_per_second,
|
54
54
|
:evicted_keys,
|
55
|
+
# :keyspace_hit_ratio,
|
56
|
+
:keyspace_hit_ratio_per_second,
|
55
57
|
:keyspace_hits_per_second,
|
56
58
|
:keyspace_hits,
|
57
59
|
:keyspace_misses_per_second,
|
@@ -84,6 +86,8 @@ class RedisStat
|
|
84
86
|
:keyspace_hits_per_second => [:magenta, :bold],
|
85
87
|
:keyspace_misses => [:magenta],
|
86
88
|
:keyspace_misses_per_second => [:magenta],
|
89
|
+
:keyspace_hit_ratio => [:magenta, :bold],
|
90
|
+
:keyspace_hit_ratio_per_second => [:magenta, :bold],
|
87
91
|
:aof_current_size => [:cyan],
|
88
92
|
:aof_base_size => [:cyan],
|
89
93
|
:rdb_changes_since_last_save => [:green, :bold],
|
@@ -111,6 +115,8 @@ class RedisStat
|
|
111
115
|
:keyspace_hits_per_second => 'hit/s',
|
112
116
|
:keyspace_misses => 'mis',
|
113
117
|
:keyspace_misses_per_second => 'mis/s',
|
118
|
+
:keyspace_hit_ratio => 'hit%',
|
119
|
+
:keyspace_hit_ratio_per_second => 'hit%/s',
|
114
120
|
:aof_current_size => 'aofcs',
|
115
121
|
:aof_base_size => 'aofbs',
|
116
122
|
:rdb_changes_since_last_save => 'chsv',
|
data/lib/redis-stat/server.rb
CHANGED
@@ -59,7 +59,7 @@ class Server < Sinatra::Base
|
|
59
59
|
static = Hash[settings.redis_stat.tab_measures.map { |stat|
|
60
60
|
[stat, info[stat]]
|
61
61
|
}]
|
62
|
-
data = {:at => Time.now.to_i, :static => static, :dynamic => data}
|
62
|
+
data = {:at => (Time.now.to_f * 1000).to_i, :static => static, :dynamic => data}
|
63
63
|
|
64
64
|
hist = settings.history
|
65
65
|
settings.mutex.synchronize do
|
data/lib/redis-stat/version.rb
CHANGED
data/redis-stat.gemspec
CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.description = %q{A real-time Redis monitoring tool written in Ruby}
|
8
8
|
gem.summary = %q{A real-time Redis monitoring tool written in Ruby}
|
9
9
|
gem.homepage = "https://github.com/junegunn/redis-stat"
|
10
|
+
gem.license = 'MIT'
|
10
11
|
|
11
12
|
gem.platform = 'java' if RUBY_PLATFORM == 'java'
|
12
13
|
gem.files = `git ls-files`.split("\n").reject { |f| f =~ /^screenshots/ }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-stat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ansi
|
@@ -227,7 +227,8 @@ files:
|
|
227
227
|
- test/bin_helper.rb
|
228
228
|
- test/test_redis-stat.rb
|
229
229
|
homepage: https://github.com/junegunn/redis-stat
|
230
|
-
licenses:
|
230
|
+
licenses:
|
231
|
+
- MIT
|
231
232
|
post_install_message:
|
232
233
|
rdoc_options: []
|
233
234
|
require_paths:
|