bananastalktome / memcached_stats Goto Github PK
View Code? Open in Web Editor NEWGather stats and slab keys from memcached
License: MIT License
Gather stats and slab keys from memcached
License: MIT License
$ telnet 0 11211
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
add foo 0 0 5
bar
STORED
get foo
VALUE foo 0 5
bar
END
quit
Connection closed by foreign host.
$ gem install memcached_stats
Fetching: memcached_stats-0.0.2.gem (100%)
Successfully installed memcached_stats-0.0.2
1 gem installed
$ irb
require 'memcached_stats'
=> true
stats = MemcachedStats.new
=> #<MemcachedStats:0x00000001268990 @host="localhost", @port=11211, @slab_keys={}>
stats.fetch_all_slab_keys
=> true
stats.slabs
=> {"1"=>{"number"=>"1", "age"=>"211", "evicted"=>"0", "evicted_nonzero"=>"0", "evicted_time"=>"0", "outofmemory"=>"0", "tailrepairs"=>"0", "reclaimed"=>"0", "expired_unfetched"=>"0", "evicted_unfetched"=>"0"}}
stats.fetch_stats
ArgumentError: odd number of arguments for Hash
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:78:in `[]'
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:78:in `get_summary'
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:33:in `fetch_stats'
from (irb):3
from /home/me/.rvm/rubies/ruby-2.2.4/bin/irb:11:in `<main>'
stats = MemcachedStats.new('localhost', 11211)
=> #<MemcachedStats:0x000000011ac9c0 @host="localhost", @port=11211, @slab_keys={}>
stats.fetch_stats
ArgumentError: odd number of arguments for Hash
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:78:in `[]'
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:78:in `get_summary'
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:33:in `fetch_stats'
from (irb):5
from /home/me/.rvm/rubies/ruby-2.2.4/bin/irb:11:in `<main>'
stats = MemcachedStats.new('127.0.0.1', '11211')
=> #<MemcachedStats:0x000000011740e8 @host="127.0.0.1", @port=11211, @slab_keys={}>
stats.fetch_stats
ArgumentError: odd number of arguments for Hash
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:78:in `[]'
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:78:in `get_summary'
from /home/me/.rvm/gems/ruby-2.2.4/gems/memcached_stats-0.0.2/lib/memcached_stats/base.rb:33:in `fetch_stats'
from (irb):7
from /home/me/.rvm/rubies/ruby-2.2.4/bin/irb:11:in `<main>'
stats = MemcachedStats.new
stats.fetch_all_slab_keys
stats.slab_keys
stats.fetch_all_slab_keys
stats.slab_keys # new keys not listed
stats.fetch_stats # new keys not listed
When I instantiate again it's ok:
stats = MemcachedStats.new
stats.fetch_all_slab_keys
stats.slab_keys # all keys listed
stats.fetch_stats # all keys listed
I'm not sure if it's a bug or feature. Is there any other way to get fresh output?
This "issue" is more of a forum discussion, in which I hope people can help me arrive at an intuitive, clean, and efficient way to implement gathering stats (both basic and slab) from multiple memcached instances. The code (as it is thus far) is in the experimental branch. Thanks in advance!
$ gem install memcached_stats
ERROR: Could not find a valid gem 'memcached_stats' (>= 0) in any repository
ERROR: Possible alternatives: memcachestats, memcache_stat, memcached-seanl, memcached_store, cache_stats
$ git clone https://github.com/bananastalktome/memcached_stats
$ cd memcached_stats/
[memcached_stats (master)]$ gem build memcached_stats.gemspec
WARNING: See http://guides.rubygems.org/specification-reference/ for help
ERROR: While executing gem ... (Gem::InvalidSpecificationException)
["README.html"] are not files
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.