fix influxdb

This commit is contained in:
anlicheng 2023-07-27 17:46:16 +08:00
parent 1e96ff8bbf
commit bb753146ac

View File

@ -140,18 +140,13 @@ handle_cast({write, Bucket, Org, Precision, Points}, State = #state{host = Host,
lager:debug("[influx_client] url is: ~p, headers: ~p, body: ~ts", [Url, Headers, Body]), lager:debug("[influx_client] url is: ~p, headers: ~p, body: ~ts", [Url, Headers, Body]),
case hackney:request(post, Url, Headers, GZipBody, [{pool, influx_pool}]) of case hackney:request(post, Url, Headers, GZipBody, [{pool, influx_pool}]) of
{ok, StatusCode, _RespHeaders, ClientRef} -> {ok, StatusCode, _RespHeaders, ClientRef} ->
case StatusCode >= 200 andalso StatusCode < 300 of case hackney:body(ClientRef) of
true -> {ok, RespBody} ->
case hackney:body(ClientRef) of lager:debug("[influx_client] status_code: ~p, response body is: ~p", [StatusCode, RespBody]);
{ok, RespBody} -> {error, Error} ->
lager:debug("[influx_client] status_code: ~p, response body is: ~p", [StatusCode, RespBody]); lager:warning("[influx_client] status_code: ~p, error is: ~p", [Error])
{error, Error} -> end,
lager:warning("[influx_client] response error is: ~p", [Error]) hackney:close(ClientRef);
end;
false ->
lager:debug("[influx_client] status_code: ~p", [StatusCode]),
hackney:close(ClientRef)
end;
{error, Reason} -> {error, Reason} ->
lager:warning("[influx_client] request result is: ~p", [Reason]) lager:warning("[influx_client] request result is: ~p", [Reason])
end, end,