Skip to content

Instantly share code, notes, and snippets.

@cdahlqvist
Forked from kellymclaughlin/pb_status_anon.txt
Last active December 17, 2015 16:18
Show Gist options
  • Select an option

  • Save cdahlqvist/5637415 to your computer and use it in GitHub Desktop.

Select an option

Save cdahlqvist/5637415 to your computer and use it in GitHub Desktop.

Revisions

  1. Christian Dahlqvist revised this gist May 24, 2013. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions pb_status_anon.txt
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,18 @@ PBStatusFun = fun() ->
    [poolboy:status(Pid) || Pid <- PoolboyPids]
    end.

    PBStatusCountFun = 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],
    List = [poolboy:status(Pid) || Pid <- PoolboyPids],
    dict:to_list(lists:foldl(fun(Item, Acc) ->
    dict:update_counter(Item, 1, Acc)
    end, dict:new(), List))
    end.

    PBStatusFun = fun(Index) ->
    {_, VnodePid} = riak_core_vnode_manager:get_vnode_pid(Index, riak_kv_vnode),
    Links = process_info(VnodePid, [links]),
  2. @kellymclaughlin kellymclaughlin revised this gist Nov 15, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pb_status_anon.txt
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ PBStatusFun = fun(Index) ->
    WorkerPoolLink = process_info(WorkerPoolPid, [links]),
    [{links,[_, PoolboyPid]}] = WorkerPoolLink,
    Status = poolboy:status(PoolboyPid),
    io:format("Pool Pid: ~p Status: ~p~n", [Pid, Status])
    io:format("Pool Pid: ~p Status: ~p~n", [PoolboyPid, Status])
    end.

    %% Paste this into console and then run: PBStatusFun().
  3. @kellymclaughlin kellymclaughlin revised this gist Nov 15, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion pb_status_anon.txt
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,8 @@ PBStatusFun = fun(Index) ->
    [{links,[_, WorkerPoolPid]}] = Links,
    WorkerPoolLink = process_info(WorkerPoolPid, [links]),
    [{links,[_, PoolboyPid]}] = WorkerPoolLink,
    poolboy:status(PoolboyPid)
    Status = poolboy:status(PoolboyPid),
    io:format("Pool Pid: ~p Status: ~p~n", [Pid, Status])
    end.

    %% Paste this into console and then run: PBStatusFun().
  4. @kellymclaughlin kellymclaughlin revised this gist Nov 7, 2012. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions pb_status_anon.txt
    Original file line number Diff line number Diff line change
    @@ -7,4 +7,13 @@ PBStatusFun = fun() ->
    [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,
    poolboy:status(PoolboyPid)
    end.

    %% Paste this into console and then run: PBStatusFun().
  5. @kellymclaughlin kellymclaughlin created this gist Sep 28, 2012.
    10 changes: 10 additions & 0 deletions pb_status_anon.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    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.

    %% Paste this into console and then run: PBStatusFun().
    11 changes: 11 additions & 0 deletions poolboy_helper.erl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    -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].