Skip to content

Commit

Permalink
Separation of VM stats based on node() value
Browse files Browse the repository at this point in the history
  • Loading branch information
blinkov committed May 24, 2012
1 parent ea6b9f3 commit ec6987e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/estatsd_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ do_report_vm_metrics(TsStr, State) ->
],
StatsMsg = lists:map(fun({Key, Val}) ->
[
"stats.vm.stats.", key2str(Key), " ",
"stats.vm.", node_key(), ".stats.", key2str(Key), " ",
io_lib:format("~w", [Val]), " ",
TsStr, "\n"
]
end, StatsData),
MemoryMsg = lists:map(fun({Key, Val}) ->
[
"stats.vm.memory.", key2str(Key), " ",
"stats.vm.", node_key(), ".memory.", key2str(Key), " ",
io_lib:format("~w", [Val]), " ",
TsStr, "\n"
]
Expand All @@ -258,3 +258,11 @@ do_report_vm_metrics(TsStr, State) ->
Msg = []
end,
{Msg, length(Msg)}.

node_key() ->
NodeList = atom_to_list(node()),
{ok, R} = re:compile("[\@\.]"),
Opts = [global, {return, list}],
S = re:replace(NodeList, R, "_", Opts),
key2str(S).

0 comments on commit ec6987e

Please sign in to comment.