fix: pass stop_action_after_render=true in trace meta data
Even if there is no trace we still need to pass stop_action_after_render=true in the trace meta data so that the action will be stopped.
This commit is contained in:
parent
aa950f97fa
commit
f444c6fc32
|
@ -471,23 +471,35 @@ do_handle_action(RuleId, #{mod := Mod, func := Func} = Action, Selected, Envs) -
|
||||||
Result.
|
Result.
|
||||||
|
|
||||||
do_handle_action_get_trace_inc_metrics_context(RuleID, Action) ->
|
do_handle_action_get_trace_inc_metrics_context(RuleID, Action) ->
|
||||||
case emqx_trace:list() of
|
case {emqx_trace:list(), logger:get_process_metadata()} of
|
||||||
[] ->
|
{[], #{stop_action_after_render := true}} ->
|
||||||
|
%% Even if there is no trace we still need to pass
|
||||||
|
%% stop_action_after_render in the trace meta data so that the
|
||||||
|
%% action will be stopped.
|
||||||
|
{
|
||||||
|
#{
|
||||||
|
stop_action_after_render => true
|
||||||
|
},
|
||||||
|
#{
|
||||||
|
rule_id => RuleID,
|
||||||
|
action_id => Action
|
||||||
|
}
|
||||||
|
};
|
||||||
|
{[], _} ->
|
||||||
%% As a performance/memory optimization, we don't create any trace
|
%% As a performance/memory optimization, we don't create any trace
|
||||||
%% context if there are no trace patterns.
|
%% context if there are no trace patterns.
|
||||||
{undefined, #{
|
{undefined, #{
|
||||||
rule_id => RuleID,
|
rule_id => RuleID,
|
||||||
action_id => Action
|
action_id => Action
|
||||||
}};
|
}};
|
||||||
_List ->
|
{_List, TraceMeta} ->
|
||||||
Ctx = do_handle_action_get_trace_inc_metrics_context_unconditionally(Action),
|
Ctx = do_handle_action_get_trace_inc_metrics_context_unconditionally(Action, TraceMeta),
|
||||||
{maps:remove(action_id, Ctx), Ctx}
|
{maps:remove(action_id, Ctx), Ctx}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
do_handle_action_get_trace_inc_metrics_context_unconditionally(Action) ->
|
do_handle_action_get_trace_inc_metrics_context_unconditionally(Action, TraceMeta) ->
|
||||||
Metadata = logger:get_process_metadata(),
|
StopAfterRender = maps:get(stop_action_after_render, TraceMeta, false),
|
||||||
StopAfterRender = maps:get(stop_action_after_render, Metadata, false),
|
case TraceMeta of
|
||||||
case Metadata of
|
|
||||||
#{
|
#{
|
||||||
rule_id := RuleID,
|
rule_id := RuleID,
|
||||||
clientid := ClientID
|
clientid := ClientID
|
||||||
|
|
Loading…
Reference in New Issue