amnesia 1.0.2 → 1.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 +4 -4
- data/lib/amnesia/helpers.rb +1 -1
- data/lib/amnesia/host.rb +8 -1
- data/lib/amnesia/public/css/application.css +1 -2
- data/lib/amnesia/routes.rb +21 -0
- data/lib/amnesia/views/host.haml +6 -6
- data/lib/amnesia/views/index.haml +6 -6
- data/lib/amnesia/views/layout.haml +1 -1
- data/lib/amnesia.rb +0 -1
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c3e3691f79fa370d7843d33890505ce19004352448f85d4f8255be655c7a5e9
|
4
|
+
data.tar.gz: 40465e097d361a541aab282e9fe12fb4bfb151a801f69be3d61737d9e9c6c5f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 335ddae603a7561ebcdb175073cbe5074c2bc6701b4728ce5478a9b81886090a5629ec94b0a54030d73eabafeb04f455ed2bb580ed1657ea98bb4d17c8ec3b5e
|
7
|
+
data.tar.gz: 851a96de408e1b67763a690534b070da37b67215bddc4f9d5b9d0d19d45e5ca82ca20b54d9d4998c8d4745aeeac22a69d796cdfea73bebd2954a9dfd5a90d241
|
data/lib/amnesia/helpers.rb
CHANGED
@@ -10,7 +10,7 @@ module Amnesia
|
|
10
10
|
SIZE_UNITS = %w[ Bytes KB MB GB TB PB EB ]
|
11
11
|
|
12
12
|
def graph_url(*data)
|
13
|
-
|
13
|
+
url "/pie?d="+data.join(',')
|
14
14
|
end
|
15
15
|
|
16
16
|
# https://github.com/rails/rails/blob/fbe335cfe09bf0949edfdf0c4b251f4d081bd5d7/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb
|
data/lib/amnesia/host.rb
CHANGED
@@ -4,9 +4,16 @@ module Amnesia
|
|
4
4
|
class Host
|
5
5
|
FLOAT_STATS = %w[ rusage_user rusage_system ]
|
6
6
|
STRING_STATS = %w[ version libevent ]
|
7
|
+
DEFAULT_PORT = 11_211
|
8
|
+
|
9
|
+
def self.normalize_address address
|
10
|
+
return "#{address}:#{DEFAULT_PORT}" unless address.include? ":"
|
11
|
+
|
12
|
+
address
|
13
|
+
end
|
7
14
|
|
8
15
|
def initialize(address)
|
9
|
-
@address = address
|
16
|
+
@address = self.class.normalize_address address
|
10
17
|
end
|
11
18
|
|
12
19
|
def alive?
|
data/lib/amnesia/routes.rb
CHANGED
@@ -6,6 +6,27 @@ module Amnesia
|
|
6
6
|
haml :index
|
7
7
|
end
|
8
8
|
|
9
|
+
get '/pie' do
|
10
|
+
data = params[:d].to_s.split(",").map(&:to_i)
|
11
|
+
|
12
|
+
r = 25
|
13
|
+
c = (2*Math::PI*r).ceil
|
14
|
+
v = data.first.to_f / data.last * 100 * c / 100
|
15
|
+
v = v.nan? ? 0 : v.ceil
|
16
|
+
|
17
|
+
content_type "image/svg+xml"
|
18
|
+
<<~BODY
|
19
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"
|
20
|
+
style="transform:rotate(-90deg);">
|
21
|
+
<circle r="#{r*2}" cx="50" cy="50" fill="#FFEBCC" />
|
22
|
+
<circle r="#{r}" cx="50" cy="50"
|
23
|
+
fill="transparent" stroke="#FF9901"
|
24
|
+
stroke-width="#{r*2}" stroke-dasharray="#{v} #{c}"
|
25
|
+
/>
|
26
|
+
</svg>
|
27
|
+
BODY
|
28
|
+
end
|
29
|
+
|
9
30
|
get '/:address' do
|
10
31
|
@host = find_host params[:address]
|
11
32
|
@host ? haml(:host) : halt(404)
|
data/lib/amnesia/views/host.haml
CHANGED
@@ -6,16 +6,16 @@
|
|
6
6
|
|
7
7
|
%article.stats
|
8
8
|
%section.stats-graph
|
9
|
-
%img{src: graph_url(@host.bytes, @host.limit_maxbytes) }
|
9
|
+
%img{src: graph_url(@host.bytes, @host.limit_maxbytes), width: 90}
|
10
10
|
%section.stats-text
|
11
11
|
%h3
|
12
|
-
%span.graph-indicator Used
|
13
|
-
\/
|
14
|
-
%p The cumulative amount of
|
12
|
+
%span.graph-indicator Used (#{number_to_human_size(@host.bytes)})
|
13
|
+
\/ Available Memory (#{number_to_human_size(@host.limit_maxbytes)})
|
14
|
+
%p The cumulative amount of available memory across all active hosts.
|
15
15
|
|
16
16
|
%article.stats
|
17
17
|
%section.stats-graph
|
18
|
-
%img{src: graph_url(@host.get_hits, @host.get_misses) }
|
18
|
+
%img{src: graph_url(@host.get_hits, @host.get_misses), width: 90}
|
19
19
|
%section.stats-text
|
20
20
|
%h3
|
21
21
|
%span.graph-indicator Hit (#{@host.get_hits})
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
%section.stats
|
26
26
|
%section.stats-graph
|
27
|
-
%img{src: graph_url(@host.cmd_get, @host.cmd_set) }
|
27
|
+
%img{src: graph_url(@host.cmd_get, @host.cmd_set), width: 90}
|
28
28
|
%section.stats-text
|
29
29
|
%h3
|
30
30
|
%span.graph-indicator Read (#{@host.cmd_get})
|
@@ -1,16 +1,16 @@
|
|
1
1
|
- if alive_hosts.any?
|
2
2
|
%article.stats
|
3
3
|
%section.stats-graph
|
4
|
-
%img{src: graph_url(bytes_sum, limit_maxbytes_sum)}
|
4
|
+
%img{src: graph_url(bytes_sum, limit_maxbytes_sum), width: 90}
|
5
5
|
%section.stats-text
|
6
6
|
%h3
|
7
|
-
%span.graph-indicator Used
|
8
|
-
\/
|
9
|
-
%p The cumulative amount of
|
7
|
+
%span.graph-indicator Used (#{number_to_human_size(bytes_sum)})
|
8
|
+
\/ Available Memory (#{number_to_human_size(limit_maxbytes_sum)})
|
9
|
+
%p The cumulative amount of available memory across all active hosts.
|
10
10
|
|
11
11
|
%article.stats
|
12
12
|
%section.stats-graph
|
13
|
-
%img{src: graph_url(get_hits_sum, get_misses_sum)}
|
13
|
+
%img{src: graph_url(get_hits_sum, get_misses_sum), width: 90}
|
14
14
|
%section.stats-text
|
15
15
|
%h3
|
16
16
|
%span.graph-indicator Hit (#{get_hits_sum})
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
%article.stats
|
21
21
|
%section.stats-graph
|
22
|
-
%img{src: graph_url(cmd_get_sum, cmd_set_sum)}
|
22
|
+
%img{src: graph_url(cmd_get_sum, cmd_set_sum), width: 90}
|
23
23
|
%section.stats-text
|
24
24
|
%h3
|
25
25
|
%span.graph-indicator Read (#{cmd_get_sum})
|
data/lib/amnesia.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amnesia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Schwarz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dalli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: googlecharts
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.6.8
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.6.8
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: haml
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +80,20 @@ dependencies:
|
|
94
80
|
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: thin
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
97
|
description: With Amnesia you'll know exactly whats happening with memory when it
|
98
98
|
comes to memcached.
|
99
99
|
email:
|
@@ -116,7 +116,7 @@ files:
|
|
116
116
|
homepage: http://github.com/benschwarz/amnesia
|
117
117
|
licenses: []
|
118
118
|
metadata: {}
|
119
|
-
post_install_message:
|
119
|
+
post_install_message:
|
120
120
|
rdoc_options: []
|
121
121
|
require_paths:
|
122
122
|
- lib
|
@@ -131,8 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
135
|
-
signing_key:
|
134
|
+
rubygems_version: 3.4.1
|
135
|
+
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Amnesia is what you get when you lose your memory
|
138
138
|
test_files: []
|