redis_dashboard 0.1.6 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 07fbe3277b0fe36b364d375822c18bdecad129bd
4
- data.tar.gz: a82e081fbd25d0e9908788fd7faeec89a9c730b6
2
+ SHA256:
3
+ metadata.gz: c9f712009a2a6aaf18f7dc9ae5ffa8ed7fd82bdeddc415f140c250a9043652f8
4
+ data.tar.gz: 3eebf9aa402bee15fcc14af27dc413c00880fad12742be6382a38c1f66a81848
5
5
  SHA512:
6
- metadata.gz: 0ee9fdc9fc54713c70d558e7c1987869a24f710e8dbdaf30aa6474827b2baa21ccd7963e2a477c07827a106ee812247fbf75b49d6dbd14a04025d9f2aa551bc1
7
- data.tar.gz: 4f3ab7452ecf9c9c489e04f6c57e344f777c8a80af4abc5b7e08673272cd088ef2bba43c8f6889d1cbe31b7c756d184539745d9694832efbf820e9f34cce3e42
6
+ metadata.gz: 0bf3538439851524bcc5cb5ee97d486b935a71995ae5d4be78cf12ab9f598297f9dc67d87e981918292575c56dc97e2d6dcd5875a19d9106853f2432fa915074
7
+ data.tar.gz: c180db4825405d3e3dbee1d95756ca3954b91c2300ad8f4731938658387404b5b0512356778038a2842b402ac98f569d0a805608c310da86b87d8a46ba440b44
data/Gemfile CHANGED
@@ -3,4 +3,4 @@ source "https://rubygems.org"
3
3
  gem "sinatra"
4
4
  gem "erubi"
5
5
  gem "redis"
6
- gem "sass"
6
+ gem "sassc"
@@ -1,27 +1,23 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- erubi (1.8.0)
5
- ffi (1.11.1)
6
- mustermann (1.0.3)
7
- rack (2.0.7)
8
- rack-protection (2.0.5)
4
+ erubi (1.9.0)
5
+ ffi (1.12.2)
6
+ mustermann (1.1.1)
7
+ ruby2_keywords (~> 0.0.1)
8
+ rack (2.2.2)
9
+ rack-protection (2.0.8.1)
9
10
  rack
10
- rb-fsevent (0.10.3)
11
- rb-inotify (0.10.0)
12
- ffi (~> 1.0)
13
- redis (4.1.2)
14
- sass (3.7.4)
15
- sass-listen (~> 4.0.0)
16
- sass-listen (4.0.0)
17
- rb-fsevent (~> 0.9, >= 0.9.4)
18
- rb-inotify (~> 0.9, >= 0.9.7)
19
- sinatra (2.0.5)
11
+ redis (4.1.3)
12
+ ruby2_keywords (0.0.2)
13
+ sassc (2.2.1)
14
+ ffi (~> 1.9)
15
+ sinatra (2.0.8.1)
20
16
  mustermann (~> 1.0)
21
17
  rack (~> 2.0)
22
- rack-protection (= 2.0.5)
18
+ rack-protection (= 2.0.8.1)
23
19
  tilt (~> 2.0)
24
- tilt (2.0.9)
20
+ tilt (2.0.10)
25
21
 
26
22
  PLATFORMS
27
23
  ruby
@@ -29,8 +25,8 @@ PLATFORMS
29
25
  DEPENDENCIES
30
26
  erubi
31
27
  redis
32
- sass
28
+ sassc
33
29
  sinatra
34
30
 
35
31
  BUNDLED WITH
36
- 1.15.0
32
+ 1.17.2
@@ -32,6 +32,10 @@ class RedisDashboard::Application < Sinatra::Base
32
32
  erb(:slowlog, locals: {client: client, commands: client.slow_commands})
33
33
  end
34
34
 
35
+ get "/memory" do
36
+ erb(:memory, locals: {client: client, stats: client.memory_stats})
37
+ end
38
+
35
39
  get "/application.css" do
36
40
  scss(:application, style: :expanded)
37
41
  end
@@ -10,12 +10,7 @@ class RedisDashboard::Client
10
10
  end
11
11
 
12
12
  def config
13
- hash = {}
14
- array = connection.config("get", "*")
15
- while (pair = array.slice!(0, 2)).any?
16
- hash[pair.first] = pair.last
17
- end
18
- hash
13
+ array_reply_to_hash(connection.config("get", "*"))
19
14
  end
20
15
 
21
16
  def info
@@ -40,6 +35,10 @@ class RedisDashboard::Client
40
35
  end.sort{ |left, right| right.microseconds <=> left.microseconds }
41
36
  end
42
37
 
38
+ def memory_stats
39
+ array_reply_to_hash(connection.memory("stats"))
40
+ end
41
+
43
42
  def close
44
43
  connection.close if connection
45
44
  end
@@ -49,4 +48,13 @@ class RedisDashboard::Client
49
48
  def connection
50
49
  @connection ||= Redis.new(url: url)
51
50
  end
51
+
52
+ # Array reply is a Redis format which is translated into a hash for convenience.
53
+ def array_reply_to_hash(array)
54
+ hash = {}
55
+ while (pair = array.slice!(0, 2)).any?
56
+ hash[pair.first] = pair.last.is_a?(Array) ? array_reply_to_hash(pair.last) : pair.last
57
+ end
58
+ hash
59
+ end
52
60
  end
@@ -18,3 +18,9 @@
18
18
  <% end %>
19
19
  </table>
20
20
  </div>
21
+
22
+ <a href="https://redis.io/commands/client-list">
23
+ <svg viewBox="0 0 24 24">
24
+ <path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" />
25
+ </svg> Redis client list documentation
26
+ </a>
@@ -21,6 +21,7 @@
21
21
  <a class="page-menu-item <%= 'active' if active_page?('clients') %>" href="<%= url("/clients?id=#{redis_id}") %>">Clients</a>
22
22
  <a class="page-menu-item <%= 'active' if active_page?('stats') %>" href="<%= url("/stats?id=#{redis_id}") %>">Stats</a>
23
23
  <a class="page-menu-item <%= 'active' if active_page?('slowlog') %>" href="<%= url("/slowlog?id=#{redis_id}") %>">Slowlog</a>
24
+ <a class="page-menu-item <%= 'active' if active_page?('memory') %>" href="<%= url("/memory?id=#{redis_id}") %>">Memory</a>
24
25
  </div>
25
26
  <% end %>
26
27
  </div>
@@ -0,0 +1,24 @@
1
+ <div class="table">
2
+ <table>
3
+ <% for (key,value) in stats %>
4
+ <tr>
5
+ <td class="key"><%= key %></td>
6
+ <td>
7
+ <% if value.is_a?(Hash) %>
8
+ <% for (sub_key, sub_value) in value %>
9
+ <%= "#{sub_key}: #{sub_value}" %><br/>
10
+ <% end %>
11
+ <% else %>
12
+ <%= value %>
13
+ <% end %>
14
+ </td>
15
+ </tr>
16
+ <% end %>
17
+ </table>
18
+ </div>
19
+
20
+ <a href="https://github.com/antirez/redis/blob/unstable/redis.conf">
21
+ <svg viewBox="0 0 24 24">
22
+ <path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" />
23
+ </svg> Redis memory stats documentation
24
+ </a>
@@ -22,3 +22,9 @@
22
22
  <% end %>
23
23
  </table>
24
24
  </div>
25
+
26
+ <a href="https://redis.io/commands/slowlog">
27
+ <svg viewBox="0 0 24 24">
28
+ <path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" />
29
+ </svg> Redis slowlog documentation
30
+ </a>
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "redis_dashboard"
6
- spec.version = "0.1.6"
6
+ spec.version = "0.2.0"
7
7
  spec.authors = ["Alexis Bernard"]
8
8
  spec.email = ["alexis@bernard.io"]
9
9
  spec.summary = "Sinatra app to monitor Redis servers."
@@ -19,5 +19,5 @@ Gem::Specification.new do |spec|
19
19
  spec.add_runtime_dependency "sinatra"
20
20
  spec.add_runtime_dependency "erubi"
21
21
  spec.add_runtime_dependency "redis"
22
- spec.add_runtime_dependency "sass"
22
+ spec.add_runtime_dependency "sassc"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_dashboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-16 00:00:00.000000000 Z
11
+ date: 2020-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: sass
56
+ name: sassc
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -88,6 +88,7 @@ files:
88
88
  - lib/redis_dashboard/views/index.erb
89
89
  - lib/redis_dashboard/views/info.erb
90
90
  - lib/redis_dashboard/views/layout.erb
91
+ - lib/redis_dashboard/views/memory.erb
91
92
  - lib/redis_dashboard/views/slowlog.erb
92
93
  - lib/redis_dashboard/views/stats.erb
93
94
  - lib/redis_dashboard/views/stylesheets/base.scss
@@ -119,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  - !ruby/object:Gem::Version
120
121
  version: '0'
121
122
  requirements: []
122
- rubyforge_project:
123
- rubygems_version: 2.5.2
123
+ rubygems_version: 3.0.3
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Sinatra app to monitor Redis servers.