Parcourir la source

feat: add stop after render and after render trace to redis action

Kjell Winblad il y a 1 an
Parent
commit
2abc1b1141
1 fichiers modifiés avec 10 ajouts et 1 suppressions
  1. 10 1
      apps/emqx_bridge_redis/src/emqx_bridge_redis_connector.erl

+ 10 - 1
apps/emqx_bridge_redis/src/emqx_bridge_redis_connector.erl

@@ -107,7 +107,7 @@ on_query(InstId, {cmd, Cmd}, #{conn_st := RedisConnSt}) ->
     Result;
     Result;
 on_query(
 on_query(
     InstId,
     InstId,
-    {_MessageTag, _Data} = Msg,
+    {MessageTag, _Data} = Msg,
     #{channels := Channels, conn_st := RedisConnSt}
     #{channels := Channels, conn_st := RedisConnSt}
 ) ->
 ) ->
     case try_render_message([Msg], Channels) of
     case try_render_message([Msg], Channels) of
@@ -116,6 +116,10 @@ on_query(
                 redis_bridge_connector_cmd,
                 redis_bridge_connector_cmd,
                 #{cmd => Cmd, batch => false, mode => sync}
                 #{cmd => Cmd, batch => false, mode => sync}
             ),
             ),
+            emqx_trace:rendered_action_template(
+                MessageTag,
+                #{command => Cmd, batch => false, mode => sync}
+            ),
             Result = query(InstId, {cmd, Cmd}, RedisConnSt),
             Result = query(InstId, {cmd, Cmd}, RedisConnSt),
             ?tp(
             ?tp(
                 redis_bridge_connector_send_done,
                 redis_bridge_connector_send_done,
@@ -135,6 +139,11 @@ on_batch_query(
                 redis_bridge_connector_send,
                 redis_bridge_connector_send,
                 #{batch_data => BatchData, batch => true, mode => sync}
                 #{batch_data => BatchData, batch => true, mode => sync}
             ),
             ),
+            [{ChannelID, _} | _] = BatchData,
+            emqx_trace:rendered_action_template(
+                ChannelID,
+                #{commands => Cmds, batch => ture, mode => sync}
+            ),
             Result = query(InstId, {cmds, Cmds}, RedisConnSt),
             Result = query(InstId, {cmds, Cmds}, RedisConnSt),
             ?tp(
             ?tp(
                 redis_bridge_connector_send_done,
                 redis_bridge_connector_send_done,