Skip to content

Commit b2c6f73

Browse files
committed
More forgiving of Infos
1 parent e72df16 commit b2c6f73

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

deps/rabbit_common/src/rabbit_core_metrics.erl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,7 @@ terminate() ->
121121
ok.
122122

123123
connection_created(Pid, Infos0) ->
124-
%% Note: authz_backends is added in rabbit_amqp1_0_session_sup:adapter_info/3
125-
%% We delete it here, if present, because it should not be stored in the
126-
%% connection_created table.
127-
%%
128-
%% TODO @ansd this will no longer be necessary once this PR is merged:
129-
%% https://github.com/rabbitmq/rabbitmq-server/pull/9022
130-
Infos1 = proplists:delete(authz_backends, Infos0),
124+
Infos1 = maybe_cleanup_infos(Infos0),
131125
ets:insert(connection_created, {Pid, Infos1}),
132126
ets:update_counter(connection_churn_metrics, node(), {2, 1},
133127
?CONNECTION_CHURN_METRICS),
@@ -453,3 +447,14 @@ format_auth_attempt({{RemoteAddress, Username, Protocol}, Total, Succeeded, Fail
453447
format_auth_attempt({Protocol, Total, Succeeded, Failed}) ->
454448
[{protocol, atom_to_binary(Protocol, utf8)}, {auth_attempts, Total},
455449
{auth_attempts_failed, Failed}, {auth_attempts_succeeded, Succeeded}].
450+
451+
maybe_cleanup_infos(Infos0) when is_list(Infos0) ->
452+
%% Note: authz_backends is added in rabbit_amqp1_0_session_sup:adapter_info/3
453+
%% We delete it here, if present, because it should not be stored in the
454+
%% connection_created table.
455+
%%
456+
%% TODO @ansd this will no longer be necessary once this PR is merged:
457+
%% https://github.com/rabbitmq/rabbitmq-server/pull/9022
458+
proplists:delete(authz_backends, Infos0);
459+
maybe_cleanup_infos(Infos) ->
460+
Infos.

0 commit comments

Comments
 (0)