refactor(rule_engine_metrics): refactor code_change
This commit is contained in:
parent
7605fa5e64
commit
de58c8e7bc
|
@ -324,14 +324,11 @@ handle_info(ticking, State = #state{rule_speeds = RuleSpeeds0}) ->
|
||||||
handle_info(_Info, State) ->
|
handle_info(_Info, State) ->
|
||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
code_change({down, _Vsn}, State = #state{metric_ids = MIDs}, [Vsn])
|
code_change({down, _Vsn}, State = #state{metric_ids = MIDs}, [Vsn]) ->
|
||||||
when Vsn =:= "4.3.0";
|
case string:tokens(Vsn, ".") of
|
||||||
Vsn =:= "4.3.1";
|
["4", "3", Val] ->
|
||||||
Vsn =:= "4.3.2";
|
case string:to_integer(Val) =< 7 of
|
||||||
Vsn =:= "4.3.3";
|
true ->
|
||||||
Vsn =:= "4.3.4";
|
|
||||||
Vsn =:= "4.3.5";
|
|
||||||
Vsn =:= "4.3.6" ->
|
|
||||||
[begin
|
[begin
|
||||||
Passed = get_rules_passed(Id),
|
Passed = get_rules_passed(Id),
|
||||||
Take = get_actions_taken(Id),
|
Take = get_actions_taken(Id),
|
||||||
|
@ -349,15 +346,16 @@ code_change({down, _Vsn}, State = #state{metric_ids = MIDs}, [Vsn])
|
||||||
inc_actions_retry(Id, Retry)
|
inc_actions_retry(Id, Retry)
|
||||||
end || Id <- sets:to_list(MIDs)],
|
end || Id <- sets:to_list(MIDs)],
|
||||||
{ok, State};
|
{ok, State};
|
||||||
|
false -> {ok, State}
|
||||||
|
end;
|
||||||
|
_ -> {ok, State}
|
||||||
|
end;
|
||||||
|
|
||||||
code_change(_Vsn, State = #state{metric_ids = MIDs}, [Vsn])
|
code_change(_Vsn, State = #state{metric_ids = MIDs}, [Vsn]) ->
|
||||||
when Vsn =:= "4.3.0";
|
case string:tokens(Vsn, ".") of
|
||||||
Vsn =:= "4.3.1";
|
["4", "3", Val] ->
|
||||||
Vsn =:= "4.3.2";
|
case string:to_integer(Val) =< 7 of
|
||||||
Vsn =:= "4.3.3";
|
true ->
|
||||||
Vsn =:= "4.3.4";
|
|
||||||
Vsn =:= "4.3.5";
|
|
||||||
Vsn =:= "4.3.6" ->
|
|
||||||
[begin
|
[begin
|
||||||
Matched = get_rules_matched(Id),
|
Matched = get_rules_matched(Id),
|
||||||
Take = get_actions_taken(Id),
|
Take = get_actions_taken(Id),
|
||||||
|
@ -376,6 +374,10 @@ code_change(_Vsn, State = #state{metric_ids = MIDs}, [Vsn])
|
||||||
inc_actions_retry(Id, Retry)
|
inc_actions_retry(Id, Retry)
|
||||||
end || Id <- sets:to_list(MIDs)],
|
end || Id <- sets:to_list(MIDs)],
|
||||||
{ok, State};
|
{ok, State};
|
||||||
|
false -> {ok, State}
|
||||||
|
end;
|
||||||
|
_ -> {ok, State}
|
||||||
|
end;
|
||||||
|
|
||||||
code_change(_OldVsn, State, _Extra) ->
|
code_change(_OldVsn, State, _Extra) ->
|
||||||
{ok, State}.
|
{ok, State}.
|
||||||
|
|
Loading…
Reference in New Issue