Merge pull request #13130 from kjellwinblad/kjell/fix_redis_trace_format/EMQX-12428
fix(redis trace): add separators in redis batch action trace
This commit is contained in:
commit
5017ef82a3
|
@ -1,6 +1,6 @@
|
|||
{application, emqx_bridge_redis, [
|
||||
{description, "EMQX Enterprise Redis Bridge"},
|
||||
{vsn, "0.1.6"},
|
||||
{vsn, "0.1.7"},
|
||||
{registered, []},
|
||||
{applications, [
|
||||
kernel,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
-include_lib("emqx/include/logger.hrl").
|
||||
-include_lib("emqx_resource/include/emqx_resource.hrl").
|
||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||
-include_lib("emqx/include/emqx_trace.hrl").
|
||||
|
||||
-behaviour(emqx_resource).
|
||||
|
||||
|
@ -143,7 +144,13 @@ on_batch_query(
|
|||
[{ChannelID, _} | _] = BatchData,
|
||||
emqx_trace:rendered_action_template(
|
||||
ChannelID,
|
||||
#{commands => Cmds, batch => ture}
|
||||
#{
|
||||
commands => #emqx_trace_format_func_data{
|
||||
function = fun trace_format_commands/1,
|
||||
data = Cmds
|
||||
},
|
||||
batch => true
|
||||
}
|
||||
),
|
||||
Result = query(InstId, {cmds, Cmds}, RedisConnSt),
|
||||
?tp(
|
||||
|
@ -162,6 +169,10 @@ on_batch_query(
|
|||
Error
|
||||
end.
|
||||
|
||||
trace_format_commands(Commands0) ->
|
||||
Commands1 = [lists:join(" ", C) || C <- Commands0],
|
||||
unicode:characters_to_binary(lists:join("; ", Commands1)).
|
||||
|
||||
on_format_query_result({ok, Msg}) ->
|
||||
#{result => ok, message => Msg};
|
||||
on_format_query_result(Res) ->
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Traces for Redis action batch requests have got improved formatting. Spaces are now added between components of commands and semicolons are added between commands to make the trace message easier to read.
|
Loading…
Reference in New Issue