Skip to content

Instantly share code, notes, and snippets.

@kellymclaughlin
Created September 28, 2012 21:18
Show Gist options
  • Save kellymclaughlin/3802132 to your computer and use it in GitHub Desktop.
Save kellymclaughlin/3802132 to your computer and use it in GitHub Desktop.
How to get poolboy status for each Riak Vnode
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().
-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