Merge pull request #11336 from savonarola/0724-trace-authz
Trace non-resultative authz calls
This commit is contained in:
commit
08795f559c
|
@ -498,7 +498,10 @@ do_authorize(_Client, _PubSub, _Topic, []) ->
|
||||||
do_authorize(Client, PubSub, Topic, [#{enable := false} | Rest]) ->
|
do_authorize(Client, PubSub, Topic, [#{enable := false} | Rest]) ->
|
||||||
do_authorize(Client, PubSub, Topic, Rest);
|
do_authorize(Client, PubSub, Topic, Rest);
|
||||||
do_authorize(
|
do_authorize(
|
||||||
Client,
|
#{
|
||||||
|
username := Username,
|
||||||
|
peerhost := IpAddress
|
||||||
|
} = Client,
|
||||||
PubSub,
|
PubSub,
|
||||||
Topic,
|
Topic,
|
||||||
[Connector = #{type := Type} | Tail]
|
[Connector = #{type := Type} | Tail]
|
||||||
|
@ -508,11 +511,32 @@ do_authorize(
|
||||||
try Module:authorize(Client, PubSub, Topic, Connector) of
|
try Module:authorize(Client, PubSub, Topic, Connector) of
|
||||||
nomatch ->
|
nomatch ->
|
||||||
emqx_metrics_worker:inc(authz_metrics, Type, nomatch),
|
emqx_metrics_worker:inc(authz_metrics, Type, nomatch),
|
||||||
|
?TRACE("AUTHZ", "authorization_module_nomatch", #{
|
||||||
|
module => Module,
|
||||||
|
username => Username,
|
||||||
|
ipaddr => IpAddress,
|
||||||
|
topic => Topic,
|
||||||
|
pub_sub => PubSub
|
||||||
|
}),
|
||||||
do_authorize(Client, PubSub, Topic, Tail);
|
do_authorize(Client, PubSub, Topic, Tail);
|
||||||
%% {matched, allow | deny | ignore}
|
%% {matched, allow | deny | ignore}
|
||||||
{matched, ignore} ->
|
{matched, ignore} ->
|
||||||
|
?TRACE("AUTHZ", "authorization_module_match_ignore", #{
|
||||||
|
module => Module,
|
||||||
|
username => Username,
|
||||||
|
ipaddr => IpAddress,
|
||||||
|
topic => Topic,
|
||||||
|
pub_sub => PubSub
|
||||||
|
}),
|
||||||
do_authorize(Client, PubSub, Topic, Tail);
|
do_authorize(Client, PubSub, Topic, Tail);
|
||||||
ignore ->
|
ignore ->
|
||||||
|
?TRACE("AUTHZ", "authorization_module_ignore", #{
|
||||||
|
module => Module,
|
||||||
|
username => Username,
|
||||||
|
ipaddr => IpAddress,
|
||||||
|
topic => Topic,
|
||||||
|
pub_sub => PubSub
|
||||||
|
}),
|
||||||
do_authorize(Client, PubSub, Topic, Tail);
|
do_authorize(Client, PubSub, Topic, Tail);
|
||||||
%% {matched, allow | deny}
|
%% {matched, allow | deny}
|
||||||
Matched ->
|
Matched ->
|
||||||
|
|
Loading…
Reference in New Issue