From 77042ea8977d2cb62258b7bf92ab4d4faa1acd72 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Wed, 4 Dec 2024 16:22:57 +0100 Subject: [PATCH] Disable the most noisy global distribution logs --- .../mod_global_distrib_connection.erl | 10 ++++++++-- src/global_distrib/mod_global_distrib_receiver.erl | 13 ++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/global_distrib/mod_global_distrib_connection.erl b/src/global_distrib/mod_global_distrib_connection.erl index ec7ad70f37b..1a8594d7cab 100644 --- a/src/global_distrib/mod_global_distrib_connection.erl +++ b/src/global_distrib/mod_global_distrib_connection.erl @@ -108,8 +108,14 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. terminate(Reason, State) -> - ?LOG_ERROR(#{what => gd_outgoing_socket_error, - reason => Reason, peer => State#state.peer, conn_id => State#state.conn_id}), + case Reason of + shutdown -> + ?LOG_INFO(#{what => gd_outgoing_socket_error, + reason => Reason, peer => State#state.peer, conn_id => State#state.conn_id}); + _ -> + ?LOG_ERROR(#{what => gd_outgoing_socket_error, + reason => Reason, peer => State#state.peer, conn_id => State#state.conn_id}) + end, mongoose_instrument:execute(?GLOBAL_DISTRIB_OUTGOING_CLOSED, #{}, #{count => 1, host => State#state.host}), catch mod_global_distrib_transport:close(State#state.socket), ignore. diff --git a/src/global_distrib/mod_global_distrib_receiver.erl b/src/global_distrib/mod_global_distrib_receiver.erl index 3cb4f89bfc5..00300d00e08 100644 --- a/src/global_distrib/mod_global_distrib_receiver.erl +++ b/src/global_distrib/mod_global_distrib_receiver.erl @@ -135,9 +135,16 @@ code_change(_Version, State, _Extra) -> {ok, State}. terminate(Reason, State) -> - ?LOG_WARNING(#{what => gd_incoming_socket_closed, - peer => State#state.peer, server => State#state.host, - reason => Reason, conn_id => State#state.conn_id}), + case Reason of + normal -> + ?LOG_INFO(#{what => gd_incoming_socket_closed, + peer => State#state.peer, server => State#state.host, + reason => Reason, conn_id => State#state.conn_id}); + _ -> + ?LOG_WARNING(#{what => gd_incoming_socket_closed, + peer => State#state.peer, server => State#state.host, + reason => Reason, conn_id => State#state.conn_id}) + end, mongoose_instrument:execute(?GLOBAL_DISTRIB_INCOMING_CLOSED, #{}, #{count => 1, host => State#state.host}), catch mod_global_distrib_transport:close(State#state.socket),