forked from memcached/memcached
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow accessing server stats from the configuration thread (useful for crons, checking start args, etc). Does not support cachedump or detail. Returns a table of the results. The results are thus unordered.
- Loading branch information
Showing
9 changed files
with
159 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
function dump_stats(s) | ||
print("STATS DUMP") | ||
for k, v in pairs(s) do | ||
print("key/val:", k, v) | ||
end | ||
print("END STATS DUMP") | ||
end | ||
|
||
function mcp_config_pools() | ||
--[[mcp.register_cron("stats", { every = 2, func = function() | ||
local s = mcp.server_stats("slabs") | ||
dump_stats(s) | ||
end })]]-- | ||
|
||
local s | ||
s = mcp.server_stats() | ||
dump_stats(s) | ||
|
||
s = mcp.server_stats("settings") | ||
dump_stats(s) | ||
|
||
s = mcp.server_stats("conns") | ||
dump_stats(s) | ||
|
||
s = mcp.server_stats("extstore") | ||
dump_stats(s) | ||
|
||
s = mcp.server_stats("proxy") | ||
dump_stats(s) | ||
|
||
s = mcp.server_stats("proxyfuncs") | ||
dump_stats(s) | ||
|
||
s = mcp.server_stats("proxybe") | ||
dump_stats(s) | ||
|
||
s = mcp.server_stats("items") | ||
dump_stats(s) | ||
|
||
s = mcp.server_stats("slabs") | ||
dump_stats(s) | ||
end | ||
|
||
function mcp_config_routes(c) | ||
mcp.attach(mcp.CMD_ANY_STORAGE, function(r) | ||
return mcp.internal(r) | ||
end) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use FindBin qw($Bin); | ||
use lib "$Bin/lib"; | ||
use Carp qw(croak); | ||
use MemcachedTest; | ||
use IO::Socket qw(AF_INET SOCK_STREAM); | ||
use IO::Select; | ||
use Data::Dumper qw/Dumper/; | ||
|
||
if (!supports_proxy()) { | ||
plan skip_all => 'proxy not enabled'; | ||
exit 0; | ||
} | ||
|
||
my $p_srv = new_memcached('-o proxy_config=./t/proxyintstats.lua -t 1'); | ||
my $ps = $p_srv->sock; | ||
$ps->autoflush(1); | ||
|
||
pass("didn't crash"); | ||
|
||
done_testing(); |