fix(rule tracing): unset trace meta data in try-after-end
We wrap the reset of the process trace meta data in the after clause of a try-after-end expression to be sure we never get any lingering incorrect meta data.
This commit is contained in:
parent
aa388adba9
commit
3232ab5ea3
|
@ -1125,12 +1125,13 @@ call_query(QM, Id, Index, Ref, Query, QueryOpts) ->
|
||||||
{ok, _Group, #{status := ?status_connecting, error := unhealthy_target}} ->
|
{ok, _Group, #{status := ?status_connecting, error := unhealthy_target}} ->
|
||||||
{error, {unrecoverable_error, unhealthy_target}};
|
{error, {unrecoverable_error, unhealthy_target}};
|
||||||
{ok, _Group, Resource} ->
|
{ok, _Group, Resource} ->
|
||||||
|
QueryResult =
|
||||||
|
try
|
||||||
set_rule_id_trace_meta_data(Query),
|
set_rule_id_trace_meta_data(Query),
|
||||||
QueryResult = do_call_query(QM, Id, Index, Ref, Query, QueryOpts, Resource),
|
do_call_query(QM, Id, Index, Ref, Query, QueryOpts, Resource)
|
||||||
%% do_call_query does not throw an exception as the call to the
|
after
|
||||||
%% resource is wrapped in a try catch expression so we will always
|
unset_rule_id_trace_meta_data()
|
||||||
%% unset the trace meta data
|
end,
|
||||||
unset_rule_id_trace_meta_data(),
|
|
||||||
QueryResult;
|
QueryResult;
|
||||||
{error, not_found} ->
|
{error, not_found} ->
|
||||||
?RESOURCE_ERROR(not_found, "resource not found")
|
?RESOURCE_ERROR(not_found, "resource not found")
|
||||||
|
|
Loading…
Reference in New Issue