فهرست منبع

fix(metrics): remove the client. prefix for AuthN/AuthZ metrics

firest 3 سال پیش
والد
کامیت
45aa9d604b
3فایلهای تغییر یافته به همراه12 افزوده شده و 12 حذف شده
  1. 3 3
      apps/emqx/src/emqx_access_control.erl
  2. 6 6
      apps/emqx/src/emqx_metrics.erl
  3. 3 3
      apps/emqx_authz/src/emqx_authz.erl

+ 3 - 3
apps/emqx/src/emqx_access_control.erl

@@ -82,8 +82,8 @@ run_hooks(Name, Args, Acc) ->
 
 -compile({inline, [inc_authz_metrics/1]}).
 inc_authz_metrics(allow) ->
-    emqx_metrics:inc('client.authorization.allow');
+    emqx_metrics:inc('authorization.allow');
 inc_authz_metrics(deny) ->
-    emqx_metrics:inc('client.authorization.deny');
+    emqx_metrics:inc('authorization.deny');
 inc_authz_metrics(cache_hit) ->
-    emqx_metrics:inc('client.authorization.cache_hit').
+    emqx_metrics:inc('authorization.cache_hit').

+ 6 - 6
apps/emqx/src/emqx_metrics.erl

@@ -255,9 +255,9 @@
 
 %% Statistic metrics for ACL checking
 -define(STASTS_ACL_METRICS, [
-    {counter, 'client.authorization.allow'},
-    {counter, 'client.authorization.deny'},
-    {counter, 'client.authorization.cache_hit'}
+    {counter, 'authorization.allow'},
+    {counter, 'authorization.deny'},
+    {counter, 'authorization.cache_hit'}
 ]).
 
 %% Overload protetion counters
@@ -687,9 +687,9 @@ reserved_idx('session.resumed') -> 221;
 reserved_idx('session.takenover') -> 222;
 reserved_idx('session.discarded') -> 223;
 reserved_idx('session.terminated') -> 224;
-reserved_idx('client.authorization.allow') -> 300;
-reserved_idx('client.authorization.deny') -> 301;
-reserved_idx('client.authorization.cache_hit') -> 302;
+reserved_idx('authorization.allow') -> 300;
+reserved_idx('authorization.deny') -> 301;
+reserved_idx('authorization.cache_hit') -> 302;
 reserved_idx('olp.delay.ok') -> 400;
 reserved_idx('olp.delay.timeout') -> 401;
 reserved_idx('olp.hbn') -> 402;

+ 3 - 3
apps/emqx_authz/src/emqx_authz.erl

@@ -52,9 +52,9 @@
 
 -type sources() :: [source()].
 
--define(METRIC_ALLOW, 'client.authorization.matched.allow').
--define(METRIC_DENY, 'client.authorization.matched.deny').
--define(METRIC_NOMATCH, 'client.authorization.nomatch').
+-define(METRIC_ALLOW, 'authorization.matched.allow').
+-define(METRIC_DENY, 'authorization.matched.deny').
+-define(METRIC_NOMATCH, 'authorization.nomatch').
 
 -define(METRICS, [?METRIC_ALLOW, ?METRIC_DENY, ?METRIC_NOMATCH]).