Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use grpoc, not generated atoms, for stat process names

  • Loading branch information...
commit af1551d7eb4d21b887bb502cd417a9c8e28f01c4 1 parent 12c7eb7
@russelldb authored
Showing with 9 additions and 7 deletions.
  1. +2 −1  rebar.config
  2. +7 −6 src/riak_core_metric_proc.erl
View
3  rebar.config
@@ -12,5 +12,6 @@
{basho_stats, ".*", {git, "git://github.com/basho/basho_stats", "HEAD"}},
{riak_sysmon, ".*", {git, "git://github.com/basho/riak_sysmon", {branch, "master"}}},
{webmachine, ".*", {git, "git://github.com/basho/webmachine",
- {branch, "master"}}}
+ {branch, "master"}}},
+ {gproc, ".*", {git, "https://github.com/esl/gproc.git", {branch, "master"}}}
]}.
View
13 src/riak_core_metric_proc.erl
@@ -37,23 +37,24 @@
%%%===================================================================
start_link(App, Name, Args) ->
- RegName = riak_core_metric:regname(App, Name),
- gen_server:start_link({local, RegName}, ?MODULE, [{name, Name}|Args], []).
+ gen_server:start_link(?MODULE, [{app, App}, {name, Name}|Args], []).
update(App, Name, Args) ->
- RegName = riak_core_metric:regname(App, Name),
- gen_server:cast(RegName, {update, Args}).
+ Pid = gproc:where({n, l, {App, Name}}),
+ gen_server:cast(Pid, {update, Args}).
value(App, Name) ->
value(App, Name, []).
value(App, Name, Presentation) ->
- RegName = riak_core_metric:regname(App, Name),
- {ok, Val} = gen_server:call(RegName, {value, Presentation}),
+ Pid = gproc:where({n, l, {App, Name}}),
+ {ok, Val} = gen_server:call(Pid, {value, Presentation}),
Val.
init(Args) ->
Name = proplists:get_value(name, Args),
+ App = proplists:get_value(app, Args),
+ true = gproc:reg({n, l, {App, Name}}, ignored),
{type, ShortName} = proplists:lookup(type, Args), %% Does mod need init args?
Mod = mod_from_shortname(ShortName),
Description = proplists:get_value(description, Args),
Please sign in to comment.
Something went wrong with that request. Please try again.