fix: write influxdb line with undefined value

This commit is contained in:
JimMoen 2022-08-15 14:01:02 +08:00
parent 68946f1f6c
commit d0e923590e
1 changed files with 5 additions and 2 deletions

View File

@ -502,7 +502,8 @@ maps_config_to_data(K, V, {Data, Res}) ->
case {NK, NV} of case {NK, NV} of
{[undefined], _} -> {[undefined], _} ->
{Data, Res}; {Data, Res};
{_, [undefined]} -> %% undefined value in normal format [undefined] or int/uint format [undefined, <<"i">>]
{_, [undefined | _]} ->
{Data, Res}; {Data, Res};
_ -> _ ->
{Data, Res#{NK => value_type(NV)}} {Data, Res#{NK => value_type(NV)}}
@ -512,7 +513,9 @@ value_type([Int, <<"i">>]) when
is_integer(Int) is_integer(Int)
-> ->
{int, Int}; {int, Int};
value_type([UInt, <<"u">>]) -> value_type([UInt, <<"u">>]) when
is_integer(UInt)
->
{uint, UInt}; {uint, UInt};
value_type([<<"t">>]) -> value_type([<<"t">>]) ->
't'; 't';