fix: flatten Points list

This commit is contained in:
JimMoen 2022-08-11 20:58:56 +08:00
parent 3a76a50382
commit db3e4f0b90
1 changed files with 4 additions and 4 deletions

View File

@ -389,13 +389,13 @@ to_maps_config(K, V, Res) ->
%% Tags & Fields Data Trans %% Tags & Fields Data Trans
parse_batch_data(InstId, BatchData, SyntaxLines) -> parse_batch_data(InstId, BatchData, SyntaxLines) ->
{Points, Errors} = lists:foldl( {Points, Errors} = lists:foldl(
fun({send_message, Data}, {AccIn, ErrAccIn}) -> fun({send_message, Data}, {ListOfPoints, ErrAccIn}) ->
case data_to_points(Data, SyntaxLines) of case data_to_points(Data, SyntaxLines) of
{ok, Points} -> {ok, Points} ->
{[Points | AccIn], ErrAccIn}; {[Points | ListOfPoints], ErrAccIn};
{error, ErrorPoints} -> {error, ErrorPoints} ->
log_error_points(InstId, ErrorPoints), log_error_points(InstId, ErrorPoints),
{AccIn, ErrAccIn + 1} {ListOfPoints, ErrAccIn + 1}
end end
end, end,
{[], 0}, {[], 0},
@ -403,7 +403,7 @@ parse_batch_data(InstId, BatchData, SyntaxLines) ->
), ),
case Errors of case Errors of
0 -> 0 ->
{ok, Points}; {ok, lists:flatten(Points)};
_ -> _ ->
?SLOG(error, #{ ?SLOG(error, #{
msg => io_lib:format("InfluxDB trans point failed, count: ~p", [Errors]), msg => io_lib:format("InfluxDB trans point failed, count: ~p", [Errors]),