Procházet zdrojové kódy

fix: influxdb float serialization error

JimMoen před 2 roky
rodič
revize
e9f1d7f2bf

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

@@ -638,8 +638,10 @@ value_type([UInt, <<"u">>]) when
     is_integer(UInt)
 ->
     {uint, UInt};
-value_type([Float]) when is_float(Float) ->
-    Float;
+%% write `1`, `1.0`, `-1.0` all as float
+%% see also: https://docs.influxdata.com/influxdb/v2.7/reference/syntax/line-protocol/#float
+value_type([Number]) when is_number(Number) ->
+    Number;
 value_type([<<"t">>]) ->
     't';
 value_type([<<"T">>]) ->

+ 5 - 0
changes/ee/fix-11223.en.md

@@ -0,0 +1,5 @@
+In InfluxDB bridging, if intend to write using the float data type but the placeholder represents the original value
+as an integer without a decimal point during serialization, it will result in the failure of Influx Line Protocol serialization
+and the inability to write to the InfluxDB bridge.
+
+See also: [InfluxDB v2.7 Line-Protocol](https://docs.influxdata.com/influxdb/v2.7/reference/syntax/line-protocol/#float)