Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Don't double-format sysmon messages, unexport unused functions #237

Closed
wants to merge 1 commit into from

3 participants

@Vagabond

This should more safely bound the memory used when printing lots of sysmon messages, as all the formatting is done via lager's trunc_io.

@kellymclaughlin

Pushed rebased version of this branch here.

@kellymclaughlin

+1 to merge. The rebased branch should merge cleanly, but careful if you merge this one there will be some conflicts.

@Vagabond

Where do we need to merge this to for 1.3?

@kellymclaughlin

It only needs to be on master I think, but I don't see any harm in merging it to 1.2 as well.

@Vagabond

@jaredmorrow Suggestions?

@jaredmorrow

If it is dataloss I'd put to 1.2 also, otherwise just master.

@Vagabond

Merged by hand to master.

@Vagabond Vagabond closed this
@seancribbs seancribbs deleted the adt-sysmon-format branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 10 deletions.
  1. +7 −10 src/riak_core_sysmon_handler.erl
View
17 src/riak_core_sysmon_handler.erl
@@ -26,9 +26,6 @@
%% API
-export([add_handler/0]).
-%% Perhaps useful to the outside world.
--export([format_pretty_proc_info/1, format_pretty_proc_info/2,
- get_pretty_proc_info/1, get_pretty_proc_info/2]).
%% gen_event callbacks
-export([init/1, handle_event/2, handle_call/2,
@@ -81,9 +78,9 @@ init([]) ->
%% @end
%%--------------------------------------------------------------------
handle_event({monitor, Pid, Type, Info}, State) ->
- Pretty = format_pretty_proc_info(Pid, almost_current_function),
- lager:info("monitor ~w ~w ~s ~w",
- [Type, Pid, Pretty, Info]),
+ {Fmt, Args} = format_pretty_proc_info(Pid, almost_current_function),
+ lager:info("monitor ~w ~w "++ Fmt ++ " ~w",
+ [Type, Pid] ++ Args ++ [Info]),
{ok, State};
handle_event(Event, State) ->
lager:info("Monitor got ~p", [Event]),
@@ -161,13 +158,13 @@ format_pretty_proc_info(Pid, Acf) ->
try
case get_pretty_proc_info(Pid, Acf) of
undefined ->
- "";
+ {"", []};
Res ->
- io_lib:format("~w", [Res])
+ {"~w", [Res]}
end
catch X:Y ->
- io_lib:format("Pid ~w, ~W ~W at ~w\n",
- [Pid, X, 20, Y, 20, erlang:get_stacktrace()])
+ {"Pid ~w, ~W ~W at ~w\n",
+ [Pid, X, 20, Y, 20, erlang:get_stacktrace()]}
end.
get_pretty_proc_info(Pid) ->
Something went wrong with that request. Please try again.