Explorar el Código

fix(influxdb): unsupported write syntax for timestamp field

Shawn hace 1 año
padre
commit
44da30d660

+ 7 - 2
apps/emqx_bridge_influxdb/src/emqx_bridge_influxdb_connector.erl

@@ -714,8 +714,13 @@ parse_timestamp([TsBin]) ->
         {ok, binary_to_integer(TsBin)}
     catch
         _:_ ->
-            {error, TsBin}
-    end.
+            {error, {non_integer_timestamp, TsBin}}
+    end;
+parse_timestamp(InvalidTs) ->
+    %% The timestamp field must be a single integer or a single placeholder. i.e. the
+    %%   following is not allowed:
+    %%   - weather,location=us-midwest,season=summer temperature=82 ${timestamp}00
+    {error, {unsupported_placeholder_usage_for_timestamp, InvalidTs}}.
 
 continue_lines_to_points(Data, Item, Rest, ResultPointsAcc, ErrorPointsAcc) ->
     case line_to_point(Data, Item) of

+ 11 - 0
changes/ee/fix-14091.en.md

@@ -0,0 +1,11 @@
+A simple fix that removes `function_clause` from the log message if the user has provided an unsupported write syntax:
+
+```
+weather,location=us-midwest,season=summer temperature=82 ${timestamp}u
+```
+
+The error log before this fix:
+
+```
+pid: <0.558392.0>, info: {"stacktrace":["{emqx_bridge_influxdb_connector,parse_timestamp,[[1719350482910000000,<<\"u\">>]],[{file,\"emqx_bridge_influxdb_connector.erl\"},{line,692}]}", ...], ..., "error":"{error,function_clause}"}, tag: ERROR, msg: resource_exception
+```