Просмотр исходного кода

Merge pull request #14070 from terry-xiaoyu/improve-log-readability-dont-print-connector-state

chore: dont print connector states in error logs for readability
Xinyu Liu 1 год назад
Родитель
Сommit
b08da3ae32

+ 4 - 6
apps/emqx_bridge_iotdb/src/emqx_bridge_iotdb_connector.erl

@@ -514,14 +514,13 @@ on_query_async(
     InstanceId,
     Req,
     _ReplyFunAndArgs0,
-    #{driver := thrift} = State
+    #{driver := thrift}
 ) ->
     ?SLOG(error, #{
         msg => "iotdb_bridge_async_query_failed",
         instance_id => InstanceId,
         send_message => Req,
-        reason => ?THRIFT_NOT_SUPPORT_ASYNC_MSG,
-        state => emqx_utils:redact(State)
+        reason => ?THRIFT_NOT_SUPPORT_ASYNC_MSG
     }),
     {error, not_support}.
 
@@ -564,14 +563,13 @@ on_batch_query_async(
     InstanceId,
     Req,
     _ReplyFunAndArgs0,
-    #{driver := thrift} = State
+    #{driver := thrift}
 ) ->
     ?SLOG(error, #{
         msg => "iotdb_bridge_async_query_failed",
         instance_id => InstanceId,
         send_message => Req,
-        reason => ?THRIFT_NOT_SUPPORT_ASYNC_MSG,
-        state => emqx_utils:redact(State)
+        reason => ?THRIFT_NOT_SUPPORT_ASYNC_MSG
     }),
     {error, not_support}.
 

+ 1 - 1
apps/emqx_bridge_kinesis/src/emqx_bridge_kinesis.app.src

@@ -1,6 +1,6 @@
 {application, emqx_bridge_kinesis, [
     {description, "EMQX Enterprise Amazon Kinesis Bridge"},
-    {vsn, "0.2.2"},
+    {vsn, "0.2.3"},
     {registered, []},
     {applications, [
         kernel,

+ 3 - 4
apps/emqx_bridge_kinesis/src/emqx_bridge_kinesis_impl_producer.erl

@@ -118,7 +118,6 @@ on_get_status(_InstanceId, #{pool_name := Pool} = State) ->
         {error, Reason} ->
             ?SLOG(error, #{
                 msg => "kinesis_producer_get_status_failed",
-                state => State,
                 reason => Reason
             }),
             ?status_disconnected
@@ -169,7 +168,7 @@ on_get_channel_status(
     #{
         pool_name := PoolName,
         installed_channels := Channels
-    } = State
+    }
 ) ->
     #{stream_name := StreamName} = maps:get(ChannelId, Channels),
     case
@@ -195,8 +194,8 @@ on_get_channel_status(
         {error, Reason} ->
             ?SLOG(error, #{
                 msg => "kinesis_producer_get_status_failed",
-                state => State,
-                reason => Reason
+                reason => Reason,
+                stream_name => StreamName
             }),
             ?status_disconnected
     end.

+ 1 - 1
apps/emqx_bridge_sqlserver/src/emqx_bridge_sqlserver.app.src

@@ -1,6 +1,6 @@
 {application, emqx_bridge_sqlserver, [
     {description, "EMQX Enterprise SQL Server Bridge"},
-    {vsn, "0.2.5"},
+    {vsn, "0.2.6"},
     {registered, []},
     {applications, [kernel, stdlib, emqx_resource, odbc]},
     {env, [

+ 4 - 4
apps/emqx_bridge_sqlserver/src/emqx_bridge_sqlserver_connector.erl

@@ -467,9 +467,9 @@ do_query(
     end.
 
 worker_do_insert(
-    Conn, SQL, #{resource_opts := ResourceOpts, pool_name := ResourceId} = State
+    Conn, SQL, #{resource_opts := ResourceOpts, pool_name := ResourceId}
 ) ->
-    LogMeta = #{connector => ResourceId, state => State},
+    LogMeta = #{connector => ResourceId},
     try
         case execute(Conn, SQL, ?REQUEST_TTL(ResourceOpts)) of
             {selected, Rows, _} ->
@@ -481,8 +481,8 @@ worker_do_insert(
                 {error, {unrecoverable_error, {invalid_request, ErrStr}}}
         end
     catch
-        _Type:Reason ->
-            ?SLOG(error, LogMeta#{msg => "invalid_request", reason => Reason}),
+        _Type:Reason:St ->
+            ?SLOG(error, LogMeta#{msg => "invalid_request", reason => Reason, stacktrace => St}),
             {error, {unrecoverable_error, {invalid_request, Reason}}}
     end.
 

+ 1 - 1
apps/emqx_bridge_tdengine/src/emqx_bridge_tdengine.app.src

@@ -1,6 +1,6 @@
 {application, emqx_bridge_tdengine, [
     {description, "EMQX Enterprise TDEngine Bridge"},
-    {vsn, "0.2.3"},
+    {vsn, "0.2.4"},
     {registered, []},
     {applications, [
         kernel,

+ 2 - 2
apps/emqx_bridge_tdengine/src/emqx_bridge_tdengine_connector.erl

@@ -214,8 +214,8 @@ on_batch_query(
         _ ->
             {error, {unrecoverable_error, {invalid_channel_id, InstanceId}}}
     end;
-on_batch_query(InstanceId, BatchReq, State) ->
-    LogMeta = #{connector => InstanceId, request => BatchReq, state => State},
+on_batch_query(InstanceId, BatchReq, _State) ->
+    LogMeta = #{connector => InstanceId, request => BatchReq},
     ?SLOG(error, LogMeta#{msg => "invalid_request"}),
     {error, {unrecoverable_error, invalid_request}}.
 

Разница между файлами не показана из-за своего большого размера
+ 5 - 0
changes/ce/fix-14070.en.md