Merge pull request #7047 from EMQ-YangM/main-v4.4

fix(emqx_rule_metrics):  add a function for code hot upgrade
This commit is contained in:
Xinyu Liu 2022-02-17 18:18:39 +08:00 committed by GitHub
commit f55419f2a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -340,7 +340,7 @@ code_change({down, _Vsn}, State = #state{metric_ids = MIDs}, [Vsn]) ->
Exception = get_actions_exception(Id),
Retry = get_actions_retry(Id),
ok = delete_counters(Id),
ok = create_counters(Id, 7),
ok = create_counters(Id, max_counters_size_old()),
inc_rules_matched(Id, Passed),
inc_actions_taken(Id, Take),
inc_actions_success(Id, Success),
@ -464,6 +464,9 @@ precision(Float, N) ->
%% Metrics Definitions
%%------------------------------------------------------------------------------
%% for code hot upgrade
max_counters_size_old() -> 7.
max_counters_size() -> 11.
metrics_idx('rules.matched') -> 1;