fix: add authn authz metrics supervisor
This commit is contained in:
parent
098598a0be
commit
6530604f40
|
@ -580,7 +580,9 @@ handle_delete_authenticator(Chain, AuthenticatorID) ->
|
|||
end,
|
||||
case do_delete_authenticators(MatchFun, Chain) of
|
||||
[] -> {error, {not_found, {authenticator, AuthenticatorID}}};
|
||||
[AuthenticatorID] -> ok
|
||||
[AuthenticatorID] ->
|
||||
emqx_plugin_libs_metrics:clear_metrics(authn_metrics, AuthenticatorID),
|
||||
ok
|
||||
end.
|
||||
|
||||
handle_move_authenticator(Chain, AuthenticatorID, Position) ->
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
%%--------------------------------------------------------------------
|
||||
%% Copyright (c) 2018-2022 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||
%%
|
||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||
%% you may not use this file except in compliance with the License.
|
||||
%% You may obtain a copy of the License at
|
||||
%%
|
||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||
%%
|
||||
%% Unless required by applicable law or agreed to in writing, software
|
||||
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
%% See the License for the specific language governing permissions and
|
||||
%% limitations under the License.
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
-module(emqx_authn_authz_metrics_sup).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
-export([start_link/0]).
|
||||
|
||||
-export([init/1]).
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
||||
|
||||
init([]) ->
|
||||
AuthnMetrics = emqx_plugin_libs_metrics:child_spec(emqx_authn_metrics, authn_metrics),
|
||||
AuthzMetrics = emqx_plugin_libs_metrics:child_spec(eqmx_authz_metrics, authz_metrics),
|
||||
{ok, {
|
||||
{one_for_one, 10, 100},
|
||||
[ AuthnMetrics,
|
||||
AuthzMetrics
|
||||
]
|
||||
}}.
|
|
@ -35,7 +35,8 @@ init([]) ->
|
|||
child_spec(emqx_hooks, worker),
|
||||
child_spec(emqx_stats, worker),
|
||||
child_spec(emqx_metrics, worker),
|
||||
child_spec(emqx_ctl, worker)
|
||||
child_spec(emqx_ctl, worker),
|
||||
child_spec(emqx_authn_authz_metrics_sup, supervisor)
|
||||
]
|
||||
}}.
|
||||
|
||||
|
|
|
@ -1100,7 +1100,6 @@ update_authenticator(ConfKeyPath, ChainName, AuthenticatorID, Config) ->
|
|||
delete_authenticator(ConfKeyPath, ChainName, AuthenticatorID) ->
|
||||
case update_config(ConfKeyPath, {delete_authenticator, ChainName, AuthenticatorID}) of
|
||||
{ok, _} ->
|
||||
emqx_plugin_libs_metrics:clear_metrics(authn_metrics, AuthenticatorID),
|
||||
{204};
|
||||
{error, {_PrePostConfigUpdate, emqx_authentication, Reason}} ->
|
||||
serialize_error(Reason);
|
||||
|
|
|
@ -27,6 +27,5 @@ start_link() ->
|
|||
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
||||
|
||||
init([]) ->
|
||||
Metrics = emqx_plugin_libs_metrics:child_spec(authn_metrics),
|
||||
ChildSpecs = [Metrics],
|
||||
ChildSpecs = [],
|
||||
{ok, {{one_for_one, 10, 10}, ChildSpecs}}.
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
-export([
|
||||
start_link/1,
|
||||
stop/1,
|
||||
child_spec/1
|
||||
child_spec/1,
|
||||
child_spec/2
|
||||
]).
|
||||
|
||||
-export([
|
||||
|
@ -99,8 +100,11 @@
|
|||
|
||||
-spec child_spec(handler_name()) -> supervisor:child_spec().
|
||||
child_spec(Name) ->
|
||||
child_spec(emqx_plugin_libs_metrics, Name).
|
||||
|
||||
child_spec(ChldName, Name) ->
|
||||
#{
|
||||
id => emqx_plugin_libs_metrics,
|
||||
id => ChldName,
|
||||
start => {emqx_plugin_libs_metrics, start_link, [Name]},
|
||||
restart => permanent,
|
||||
shutdown => 5000,
|
||||
|
|
Loading…
Reference in New Issue