Skip to content

Commit 1edc89d

Browse files
committed
Update for rabbitmq-sysmon -> sysmon-handler rename
1 parent a67f30f commit 1edc89d

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ endef
138138

139139
LOCAL_DEPS = sasl mnesia os_mon inets
140140
BUILD_DEPS = rabbitmq_cli syslog
141-
DEPS = ranch lager rabbit_common ra rabbit_sysmon
141+
DEPS = ranch lager rabbit_common ra sysmon_handler
142142
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client meck proper
143143

144144
dep_syslog = git https://github.com/schlagert/syslog 3.4.5

rabbitmq-components.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ dep_cowlib = hex 2.7.0
113113
dep_jsx = hex 2.9.0
114114
dep_lager = hex 3.6.5
115115
dep_ra = git https://github.com/rabbitmq/ra.git master
116-
dep_rabbit_sysmon = git https://github.com/rabbitmq/rabbitmq-sysmon.git master
116+
dep_sysmon_handler = git https://github.com/rabbitmq/sysmon-handler.git master
117117
dep_ranch = hex 1.7.1
118118
dep_recon = hex 2.3.6
119119

src/rabbit.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@
156156
{requires, kernel_ready},
157157
{enables, core_initialized}]}).
158158

159-
-rabbit_boot_step({sysmon_minder,
159+
-rabbit_boot_step({rabbit_sysmon_minder,
160160
[{description, "sysmon_handler supervisor"},
161161
{mfa, {rabbit_sup, start_restartable_child,
162-
[sysmon_minder]}},
162+
[rabbit_sysmon_minder]}},
163163
{requires, kernel_ready},
164164
{enables, core_initialized}]}).
165165

@@ -232,7 +232,7 @@
232232
-include("rabbit_framing.hrl").
233233
-include("rabbit.hrl").
234234

235-
-define(APPS, [os_mon, mnesia, rabbit_common, ra, rabbit_sysmon, rabbit]).
235+
-define(APPS, [os_mon, mnesia, rabbit_common, ra, sysmon_handler, rabbit]).
236236

237237
-define(ASYNC_THREADS_WARNING_THRESHOLD, 8).
238238

src/sysmon_handler.erl renamed to src/rabbit_sysmon_handler.erl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
%% specific language governing permissions and limitations
1616
%% under the License.
1717

18-
%% @doc A custom event handler to the `rabbit_sysmon' application's
18+
%% @doc A custom event handler to the `sysmon_handler' application's
1919
%% `system_monitor' event manager.
2020
%%
2121
%% This module attempts to discover more information about a process
2222
%% that generates a system_monitor event.
2323

24-
-module(sysmon_handler).
24+
-module(rabbit_sysmon_handler).
2525

2626
-behaviour(gen_event).
2727

@@ -43,12 +43,11 @@
4343
add_handler() ->
4444
%% Vulnerable to race conditions (installing handler multiple
4545
%% times), but risk is zero in the common OTP app startup case.
46-
case lists:member(?MODULE,
47-
gen_event:which_handlers(rabbit_sysmon_handler)) of
46+
case lists:member(?MODULE, gen_event:which_handlers(sysmon_handler)) of
4847
true ->
4948
ok;
5049
false ->
51-
rabbit_sysmon_filter:add_custom_handler(?MODULE, [])
50+
sysmon_handler_filter:add_custom_handler(?MODULE, [])
5251
end.
5352

5453
%%%===================================================================
@@ -90,11 +89,11 @@ handle_event({monitor, PidOrPort, Type, Info}, State=#state{timer_ref=TimerRef})
9089
%% Reset the inactivity timeout
9190
NewTimerRef = reset_timer(TimerRef),
9291
{Fmt, Args} = format_pretty_proc_or_port_info(PidOrPort),
93-
rabbit_log:info("monitor ~w ~w " ++ Fmt ++ " ~w", [Type, PidOrPort] ++ Args ++ [Info]),
92+
rabbit_log:warning("~p ~w ~w " ++ Fmt ++ " ~w", [?MODULE, Type, PidOrPort] ++ Args ++ [Info]),
9493
{ok, State#state{timer_ref=NewTimerRef}};
9594
handle_event(Event, State=#state{timer_ref=TimerRef}) ->
9695
NewTimerRef = reset_timer(TimerRef),
97-
rabbit_log:info("Monitor got ~p", [Event]),
96+
rabbit_log:warning("~p unhandled event: ~p", [?MODULE, Event]),
9897
{ok, State#state{timer_ref=NewTimerRef}}.
9998

10099
%%--------------------------------------------------------------------
@@ -177,8 +176,8 @@ format_pretty_proc_or_port_info(PidOrPort) ->
177176
end.
178177

179178
get_pretty_proc_or_port_info(Pid) when is_pid(Pid) ->
180-
case process_info(Pid, [registered_name, initial_call, current_function,
181-
message_queue_len]) of
179+
Infos = [registered_name, initial_call, current_function, message_queue_len],
180+
case process_info(Pid, Infos) of
182181
undefined ->
183182
undefined;
184183
[] ->

src/sysmon_minder.erl renamed to src/rabbit_sysmon_minder.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
%%
1919
%% -------------------------------------------------------------------
2020

21-
-module(sysmon_minder).
21+
-module(rabbit_sysmon_minder).
2222

2323
-behaviour(gen_server).
2424

@@ -68,7 +68,7 @@ init([]) ->
6868
%% sysmon_handler gen_event server. (If we had a supervisor
6969
%% or app-starting process add the handler, then if the handler
7070
%% crashes, nobody will act on the crash notification.)
71-
sysmon_handler:add_handler(),
71+
rabbit_sysmon_handler:add_handler(),
7272
{ok, #state{}}.
7373

7474
%%--------------------------------------------------------------------
@@ -112,7 +112,7 @@ handle_cast(_Msg, State) ->
112112
%% {stop, Reason, State}
113113
%% @end
114114
%%--------------------------------------------------------------------
115-
handle_info({gen_event_EXIT, sysmon_handler, _}, State) ->
115+
handle_info({gen_event_EXIT, rabbit_sysmon_handler, _}, State) ->
116116
%% SASL will create an error message, no need for us to duplicate it.
117117
%%
118118
%% Our handler should never crash, but it did indeed crash. If
@@ -125,7 +125,7 @@ handle_info({gen_event_EXIT, sysmon_handler, _}, State) ->
125125
%% miss a few seconds of system_monitor events, the world will not
126126
%% end.
127127
timer:sleep(2*1000),
128-
sysmon_handler:add_handler(),
128+
rabbit_sysmon_handler:add_handler(),
129129
{noreply, State};
130130
handle_info(_Info, State) ->
131131
{noreply, State}.

0 commit comments

Comments
 (0)