Created
September 28, 2012 21:18
-
-
Save kellymclaughlin/3802132 to your computer and use it in GitHub Desktop.
How to get poolboy status for each Riak Vnode
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
PBStatusFun = fun() -> | |
VnodePids = [Pid || {_, Pid} <- riak_core_vnode_manager:all_index_pid(riak_kv_vnode)], | |
Links = [process_info(Pid, [links]) || Pid <- VnodePids], | |
WorkerPoolPids = [WPPid || [{links,[_, WPPid]}] <- Links], | |
WorkerPoolLinks = [process_info(Pid, [links]) || Pid <- WorkerPoolPids], | |
PoolboyPids = [PoolboyPid || [{links,[_, PoolboyPid]}] <- WorkerPoolLinks], | |
[poolboy:status(Pid) || Pid <- PoolboyPids] | |
end. | |
PBStatusFun = fun(Index) -> | |
{_, VnodePid} = riak_core_vnode_manager:get_vnode_pid(Index, riak_kv_vnode), | |
Links = process_info(VnodePid, [links]), | |
[{links,[_, WorkerPoolPid]}] = Links, | |
WorkerPoolLink = process_info(WorkerPoolPid, [links]), | |
[{links,[_, PoolboyPid]}] = WorkerPoolLink, | |
Status = poolboy:status(PoolboyPid), | |
io:format("Pool Pid: ~p Status: ~p~n", [PoolboyPid, Status]) | |
end. | |
%% Paste this into console and then run: PBStatusFun(). |
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
-module(poolboy_helper). | |
-compile(export_all). | |
poolboy_status() -> | |
VnodePids = [Pid || {_, Pid} <- riak_core_vnode_manager:all_index_pid(riak_kv_vnode)], | |
Links = [process_info(Pid, [links]) || Pid <- VnodePids], | |
WorkerPoolPids = [WPPid || [{links,[_, WPPid]}] <- Links], | |
WorkerPoolLinks = [process_info(Pid, [links]) || Pid <- WorkerPoolPids], | |
PoolboyPids = [PoolboyPid || [{links,[_, PoolboyPid]}] <- WorkerPoolLinks], | |
[poolboy:status(Pid) || Pid <- PoolboyPids]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment